fix(dashboards): modify myDashboards sorting logic #82364
Conversation
| @@ -163,12 +165,31 @@ def get(self, request: Request, organization) -> Response: | |||
| order_by = ["last_visited" if desc else "-last_visited"] | |||
|
|
|||
| elif sort_by == "mydashboards": | |||
There was a problem hiding this comment.
Can we feature flag this so it doesn't rollout until the table also rolls out? So current users aren't affected and it'll make more sense with the table.
Also, should this get a different sort key? Instead of mydashboards it should be something like creator now, since it doesn't prioritize the request user anymore
There was a problem hiding this comment.
I think it makes more sense to be under myDashboards since it's still prioritizing the request user's dashboards and only changing the order of the remaining dashboards
There was a problem hiding this comment.
OH oops, yeah, you're right. I misread the annotation as the sort, sounds good.
narsaynorath
left a comment
There was a problem hiding this comment.
Misread the diff the first time. Looks good now with the feature flags, just one comment about if the test needs to define the feature flag in the request too
| @@ -163,12 +165,31 @@ def get(self, request: Request, organization) -> Response: | |||
| order_by = ["last_visited" if desc else "-last_visited"] | |||
|
|
|||
| elif sort_by == "mydashboards": | |||
There was a problem hiding this comment.
OH oops, yeah, you're right. I misread the annotation as the sort, sounds good.
| Dashboard.objects.create(title="F", created_by_id=user_1.id, organization=self.organization) | ||
|
|
||
| self.login_as(user_1) | ||
| response = self.client.get(self.url, data={"sort": "mydashboards"}) |
There was a problem hiding this comment.
Does this need to get wrapped with the with features.. context so it has the table feature flag?
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #82364 +/- ##
===========================================
+ Coverage 59.10% 80.44% +21.34%
===========================================
Files 7296 7304 +8
Lines 321719 321956 +237
Branches 21017 20966 -51
===========================================
+ Hits 190140 258991 +68851
+ Misses 131173 62560 -68613
+ Partials 406 405 -1 |
Modify `myDashboards` sorting logic. Previously, the `myDashboards` sort displayed the user's dashboards first followed by other dashboards sorted by `creator id`. This PR changes that so that the other dashboards are sorted by the creator's `name`. <img width="150" alt="Screenshot 2024-12-19 at 9 58 56 AM" src="https://github.com/user-attachments/assets/2ca9f7e9-db96-4837-aae9-bab3f735bfa5" />
Modify
myDashboardssorting logic. Previously, themyDashboardssort displayed the user's dashboards first followed by other dashboards sorted bycreator id. This PR changes that so that the other dashboards are sorted by the creator'sname.