-
Notifications
You must be signed in to change notification settings - Fork 1
Heedls 532 admins no js filtering #454
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments to look at.
I'm also not seeing anything to indicate the filters are applied to a cookie - is that requirement being avoided or added in another subtask?
DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/Administrator/Index.cshtml
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/Administrator/Index.cshtml
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/Administrator/Index.cshtml
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Views/Shared/Components/CurrentFilters/Default.cshtml
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Styles/shared/searchableElements.scss
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Styles/shared/searchableElements.scss
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/ViewComponents/CurrentFiltersViewComponent.cs
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/Administrator/Index.cshtml
Show resolved
Hide resolved
...ningSolutions.Web/Controllers/TrackingSystem/Centre/Administrator/AdministratorController.cs
Show resolved
Hide resolved
I've created a separate subtask for this now. No idea how possible it will be anyway. Something to figure out once we have a working filter setup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Couple of comments I've left as unresolved as they are still open for discussion and can act as reminders for other tasks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick question - have we documented this anywhere so far?
| <input type="hidden" id="searchString" value="@Model.SearchString" /> | ||
| <input type="hidden" id="filter-by" name="filterBy" value="@Model.FilterString" /> | ||
| <input type="hidden" id="select-sort-by" value="Name" /> | ||
| <input type="hidden" id="select-sort-direction" value="Ascending" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we could use the asp-route-{value} as an alternative to all the hidden inputs in the markup?
https://docs.microsoft.com/en-us/aspnet/core/mvc/views/working-with-forms?view=aspnetcore-3.1#the-form-action-tag-helper
DigitalLearningSolutions.Web/Views/Shared/SearchablePage/_Pagination.cshtml
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Views/Shared/Components/CurrentFilters/Default.cshtml
Outdated
Show resolved
Hide resolved
...olutions.Web/ViewModels/TrackingSystem/Centre/Administrator/CentreAdministratorsViewModel.cs
Outdated
Show resolved
Hide resolved
|
|
||
| public string FilterName { get; set; } | ||
|
|
||
| public IEnumerable<(string DisplayText, string Filter)> FilterOptions { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe worth renaming the "Filter" to "Id" as a property "Filter" on "FilterOption" can get confusing
DigitalLearningSolutions.Web/ViewModels/Frameworks/AllFrameworksViewModel.cs
Outdated
Show resolved
Hide resolved
DigitalLearningSolutions.Web/ViewComponents/CurrentFiltersViewComponent.cs
Outdated
Show resolved
Hide resolved
...b.Tests/ViewModels/TrackingSystem/Centre/Administrator/CentreAdministratorsViewModelTests.cs
Show resolved
Hide resolved
| { | ||
| // Given | ||
| var inputItems = QueryableHelper.GetListOfSortableItems("a", 1, "a", 3, "b", 2); | ||
| var expectedItems = new[] { new SortableItem("a", 1), new SortableItem("a", 3) }.AsQueryable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that we declare the sortableItems anyway, could we do something like (instead of using the helper):
var inputItems = new[] { item1, item2, item3 }
var expectedItems = new[] { item1, item2 }
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it also be worth refactoring
var item1 = new SortableItem("a", 1) (or even itemA1, itemA2, itemB1)
etc
so we don't need to declare these in lots of different places?
- can do similarly in queryable extensions test
DigitalLearningSolutions.Web/Views/Shared/Components/CurrentFilters/Default.cshtml
Show resolved
Hide resolved
DigitalLearningSolutions.Web/Views/Shared/Components/CurrentFilters/Default.cshtml
Show resolved
Hide resolved
|
|
||
| public string DisplayText { get; set; } | ||
|
|
||
| public string Filter { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think Filter could have a DisplayName, just like FilterOption. I wonder if "FilterId" or "FilterValue" would be more intuitive as a name 🤔
| @@ -0,0 +1,17 @@ | |||
| namespace DigitalLearningSolutions.Web.ViewModels.Common | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we want to put all the search/sort/filter common classes under a new folder (maybe SearchSortFilter) as the Common folder is having quite a lot of classes now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would also be worth putting the ViewComponent models into a folder at some point too
| using DigitalLearningSolutions.Web.ViewModels.Common; | ||
| using Microsoft.AspNetCore.Mvc; | ||
|
|
||
| public class FilterableTagsViewComponent : ViewComponent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be a partial instead if all we need is rendering a view with the model?
|
|
||
| private static bool FilterOptionsContainsFilter( | ||
| string currentFilter, | ||
| IEnumerable<FilterOptionViewModel> filter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also be filterOptions? And should the "filterValue" be "filterOption"?
| Default, | ||
| Warning, | ||
| Success, | ||
| Other //This will result in the default blue nhsuk-tag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we support "Other" at this stage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Having spoken to Carolyn and David, they agree that the first option ([blue,] grey, red, green) would be preferred. Thanks both."
Figured I might as well stick it in, but the name is probably bad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that [blue] meant the colour of the listed filters, but I will clarify this with Kevin tomorrow morning.. Shouldn't block this though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kevin confirmed that the blue NHS tag can go and we can use blue for applied filters
| { | ||
| // Given | ||
| var inputItems = QueryableHelper.GetListOfSortableItems("a", 1, "a", 3, "b", 2); | ||
| var expectedItems = new[] { new SortableItem("a", 1), new SortableItem("a", 3) }.AsQueryable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it also be worth refactoring
var item1 = new SortableItem("a", 1) (or even itemA1, itemA2, itemB1)
etc
so we don't need to declare these in lots of different places?
- can do similarly in queryable extensions test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - added a comment about the TagStatus blue not being required, but no need for re-review 👍



Added no javascript filtering of admin users in a (hopefully) fairly generic way that can be reused for other filtering. Some of the data structures are a bit weird here in a similar way to ones for the generic sorting.
The layout gets a bit odd at very small mobile layouts due to the size of the buttons, but it's probably OK. Checked that the screen reader reads it OK