Feat/sortable sessions table headers (Visits, Views, and Last Seen Columns)#4100
Open
superham wants to merge 6 commits intoumami-software:masterfrom
Open
Feat/sortable sessions table headers (Visits, Views, and Last Seen Columns)#4100superham wants to merge 6 commits intoumami-software:masterfrom
superham wants to merge 6 commits intoumami-software:masterfrom
Conversation
|
@superham is attempting to deploy a commit to the Umami Software Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Greptile SummaryThis PR adds clickable, three-state sortable column headers (descending → ascending → clear) to the Sessions table for the Key findings:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User (Browser)
participant SL as SortableLabel
participant PQ as usePagedQuery
participant API as /api/websites/[id]/sessions
participant DB as getWebsiteSessions (SQL)
U->>SL: Click column header
SL->>SL: Cycle state: none→desc→asc→none
SL->>U: router.push(updateParams({orderBy, sortDescending, page:1}))
Note over U: URL: ?orderBy=visits&sortDescending=true&page=1
U->>PQ: Re-render (URL changed)
PQ->>PQ: Read orderBy, sortDescending from URL
PQ->>API: GET /sessions?orderBy=visits&sortDescending=true
API->>API: Zod schema: validate & transform sortDescending→boolean
API->>DB: getWebsiteSessions(websiteId, filters)
DB->>DB: Lookup SORT_COLUMNS["visits"] → '"visits"'
DB->>DB: Build sortedFilters {orderBy: '"visits"', sortDescending: true}
DB->>DB: pagedRawQuery(...ORDER BY "visits" desc)
DB-->>API: {data, count, page, pageSize, orderBy}
API-->>U: JSON response
Reviews (1): Last reviewed commit: "add cypress tests for sorting" | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds server-side sorting to the sessions table for Visits, Views, and Last Seen Columns. Clicking a sortable header cycles through descending -> ascending > default sort order
The motivation behind this is that there is no way to currently sort session table data by metrics (views, visits) which is something I find myself wanting to do.