grower and mentor sorting and filtering#163
Open
markdav-is wants to merge 2 commits into
Open
Conversation
- Add SKILL.md for returnurl navigation best practices in Oqtane modules - Refactor Edit.razor Back/Cancel to preserve filter/sort state and avoid Blazor 404s - Redesign Grower and Mentor Index filter/sort bars with flex layout - Add client-side sorting (fields, direction) for growers and mentors - Pass filter/sort state in Edit links and restore from URL - Use Open Iconic icons for navigation buttons throughout
- Update Mentor and Grower modules to v2.4.0 - Refactor Mentor Index.razor: filters, sort, and navigation now use query strings for state persistence; Edit links preserve filter context; improved responsive layout - Update Mentor Edit.razor: Back/Cancel links and post-save navigation retain filter/sort state - Add name filter to Grower Index.razor; remove ClearFilters/ApplyFilters; all filter state managed via query strings for consistency
Contributor
There was a problem hiding this comment.
Pull request overview
This PR documents a safe Oqtane navigation pattern for Edit→Index return flows and refactors the Grower and Mentor modules to preserve filter/sort state via query-string round-tripping, while modernizing the filter/sort UI.
Changes:
- Added a new skill guide describing the recommended Back/Cancel + filter state preservation pattern for Oqtane modules.
- Updated Grower and Mentor Index pages to use a unified filter/sort bar, additional filter/sort options, and query-string-based state.
- Updated Grower and Mentor Edit pages to navigate Back/Cancel using
NavigateUrl(PageState.Page.Path, PageState.QueryString)and bumped module versions to 2.4.0.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/skills/oqtane-navigation-returnurl/SKILL.md | New documentation for safe return navigation + state preservation. |
| Client/Modules/Grower/Index.razor | Filter/sort UI + query-string state management + sort logic + Edit link param propagation. |
| Client/Modules/Grower/Edit.razor | Back navigation updated to preserve query-string state. |
| Client/Modules/Grower/ModuleInfo.cs | Version bump + release history update. |
| Client/Modules/Mentor/Index.razor | Filter/sort UI + query-string state management + sort logic + Edit link state propagation. |
| Client/Modules/Mentor/Edit.razor | Back/Cancel navigation updated to preserve query-string state. |
| Client/Modules/Mentor/ModuleInfo.cs | Version bump + release history update. |
| </div> | ||
| <div> | ||
| <label for="cohortFilter" class="form-label">Cohort</label> | ||
| <select id="cohortFilter" class="form-select" @bind="_cohortFilter" @bind:after="LoadGrowersAsync"> |
Comment on lines
208
to
+212
| _statusFilter = PageState.QueryString.GetValueOrDefault("status", ""); | ||
| _villageFilter = PageState.QueryString.GetValueOrDefault("villageId", ""); | ||
| _nameFilter = PageState.QueryString.GetValueOrDefault("name", ""); | ||
| _sortBy = PageState.QueryString.GetValueOrDefault("sortBy", "lastname"); | ||
| _sortAsc = !PageState.QueryString.ContainsKey("sortDesc"); |
Comment on lines
351
to
+355
| var parts = new List<string>(); | ||
| if (!string.IsNullOrEmpty(_statusFilter)) parts.Add($"status={Uri.EscapeDataString(_statusFilter)}"); | ||
| if (!string.IsNullOrEmpty(_villageFilter)) parts.Add($"villageId={Uri.EscapeDataString(_villageFilter)}"); | ||
| if (!string.IsNullOrEmpty(_nameFilter)) parts.Add($"name={Uri.EscapeDataString(_nameFilter)}"); | ||
| if (_sortBy != "lastname") parts.Add($"sortBy={Uri.EscapeDataString(_sortBy)}"); |
| </div> | ||
| <div> | ||
| <label for="nameFilter" class="form-label">Name</label> | ||
| <input id="nameFilter" type="text" class="form-control" @bind="_nameFilter" @bind:event="oninput" @bind:after="NavigateWithFilters" placeholder="Search…" /> |
Comment on lines
362
to
364
| var queryString = BuildFilterQueryString(); | ||
| NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, queryString)); | ||
| } |
| </div> | ||
| <div> | ||
| <label class="form-label" for="filterName">Name / Username</label> | ||
| <input id="filterName" type="text" class="form-control" @bind="_nameFilter" @bind:event="oninput" @bind:after="NavigateWithFilters" placeholder="Search…" /> |
Comment on lines
+222
to
+226
| private void NavigateWithFilters() | ||
| { | ||
| _page = 1; | ||
| NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, BuildFilterQueryString())); | ||
| } |
Comment on lines
+230
to
+232
| if (PageState.QueryString.TryGetValue("villageId", out var vid) && int.TryParse(vid, out var villageId)) | ||
| _villageFilter = villageId; | ||
| _nameFilter = PageState.QueryString.GetValueOrDefault("name", ""); |
bee0790 to
e65a9f7
Compare
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.
PR Classification
Documentation and UX improvement for navigation and state preservation in Oqtane module Edit pages.
PR Summary
This PR introduces a new skill guide for safe return navigation in Oqtane modules and refactors Grower and Mentor modules to preserve filter and sort state across navigation. It also modernizes the filter/sort UI and enhances sorting/filtering capabilities.