Skip to content

feat(dashboards): add reorder and starred endpoints#119784

Open
adrianviquez wants to merge 4 commits into
masterfrom
adrian/dashboards/add-reorder-endpoints
Open

feat(dashboards): add reorder and starred endpoints#119784
adrianviquez wants to merge 4 commits into
masterfrom
adrian/dashboards/add-reorder-endpoints

Conversation

@adrianviquez

Copy link
Copy Markdown
Contributor

This PR is one of many to bring the "starred dashboards" sidebar to parity with Explore's "starred queries" sidebar.

This PR adds the starred and starred order endpoints to the dashboard set of endpoints. These are going to be pinged by the frontend to get a customers' favorite/starred dashboards, as well as the option to change their order. Added tests + a test factory as I saw a similar method to create favorite dashboards used in 2 different tests.

Additionally, I saw that the backend doesn't currently add a position when it creates a dashboard, and to change it I would have had to make a change in the deprecated favorited_by setter, so I instead opted for the insert_favorite_dashboard (and remove) logic from the DashboardFavoriteUser manager, feature flagged atm.

Closes BROWSE-612

@adrianviquez adrianviquez requested review from a team as code owners July 15, 2026 22:22
@linear-code

linear-code Bot commented Jul 15, 2026

Copy link
Copy Markdown

BROWSE-612

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 15, 2026
@getsantry getsantry Bot requested a review from a team as a code owner July 15, 2026 22:24
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@adrianviquez adrianviquez requested review from DominikB2014 and removed request for a team July 15, 2026 22:27

@DominikB2014 DominikB2014 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm!
This looks pretty similar to the explore saved queries starring, i'm starting to wonder if we should make this more generic, but i'd just follow the rule of 3 here, if there's 3 places that have a similar starring patter, then we try to share logic.

I'm also going to tag @narsaynorath on this, as he worked on dashboard ordering before so maybe there's some edge cases i can't see here

Comment on lines +286 to +299
if features.has("organizations:dashboards-starred", organization, actor=request.user):
if is_favorited:
DashboardFavoriteUser.objects.insert_favorite_dashboard(
organization=organization,
user_id=request.user.id,
dashboard=dashboard,
)
else:
DashboardFavoriteUser.objects.unfavorite_dashboard(
organization=organization,
user_id=request.user.id,
dashboard=dashboard,
)
return Response(status=204)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I feel like the variable name is_favourited is confusing, to me it's suggesting the current state of the dashboard, but in reality it represents if we should favourite the dashboard?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair point, and I agree. Will change to should_favorite and have the backend read both from isFavorited and shouldFavorite, should_favorite = request.data.get("shouldFavorite", request.data.get("isFavorited")), so things don't break

@adrianviquez

Copy link
Copy Markdown
Contributor Author

@DominikB2014 yeah fair point. I opted for this logic to be separate atm to try it out first and not over abstract, and since we had appetite to do it before but ended up reverting those changes. Plus the way we represent queries and dashboards are a bit different in the backend, so I suspect there might be some work there as well to make the endpoints for both queries + dashboards. These are expected to behave the same way in principle, so I think it makes sense to do these changes in the future if the behavior stays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants