-
Notifications
You must be signed in to change notification settings - Fork 365
NAS-139073 / 26.04 / Refactor users page filtering #13033
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
|
Claude finished @william-gr's task —— View job Code Review Complete! ✅Great refactoring work! The changes successfully simplify the users page filtering logic while maintaining good test coverage. The modern Angular patterns (signals, 🎯 Previous Review Feedback StatusThe PR addresses the previous reviewer's concerns:
💡 Positive Aspects
🔍 Issues Found1. Mode switching behavior inconsistency (users-search.component.ts:407-421)When switching from basic to advanced mode, the code resets user type selection to defaults (Local + Directory) even if the user had customized it: private resetToModeDefaults(targetMode: 'basic' | 'advanced'): void {
if (targetMode === 'basic') {
// Resets selection regardless of previous user choice
this.selectedUserTypes.set([UserType.Local, UserType.Directory]);
this.showBuiltinUsers.set(false);
this.onUserTypeChange(this.selectedUserTypes());
} else {
// Advanced mode also applies defaults
const defaultFilters = getDefaultUserTypeFilters();
this.dataProvider().setParams([defaultFilters]);
this.dataProvider().load();
}
}Issue: If a user selects only "Local" users, switches to advanced mode briefly, then switches back, their "Local only" selection is lost and reset to "Local + Directory". This could be surprising. Suggestion: Consider preserving the user's basic mode selections (user types and builtin toggle) when switching between modes, only clearing the search query text. This would provide a more intuitive experience. 2. Empty search handling could be more explicit (users-search.component.ts:268-271)protected onSearch(query: SearchQuery<User>): void {
if (!query) {
return;
}
// ...
}Issue: The early return silently ignores null/undefined queries without any feedback or default behavior. Suggestion: Consider whether an empty query should trigger a default search or reset to show all (filtered by type). The current behavior works but could be more explicit about intent. 3. Filter deduplication could be more generic (users-search.component.ts:373-405)The private removeConflictingFilters(query: AdvancedSearchQuery<User>): AdvancedSearchQuery<User> {
const builtinFilters: QueryFilter<User>[] = [];
const localFilters: QueryFilter<User>[] = [];
const otherFilters: QueryFilters<User> = [];
query.filters.forEach((filterItem) => {
if (Array.isArray(filterItem) && filterItem.length === 3) {
const [property] = filterItem;
if (property === 'builtin') {
builtinFilters.push(filterItem as QueryFilter<User>);
} else if (property === 'local') {
localFilters.push(filterItem as QueryFilter<User>);
} else {
otherFilters.push(filterItem);
}
} else {
otherFilters.push(filterItem);
}
});
// ...
}Observation: While this works well for the current use case, adding more special filters would require modifying this method. The logic is correct but not as extensible as it could be. Suggestion: Consider a more generic approach like a 4. Minor: Redundant signal update check (users-search.component.ts:272-277)// Update signal only if changed to avoid unnecessary rerenders
// For advanced queries, signal is already updated in onQueryChange
if (!this.queriesEqual(this.searchQuery(), query)) {
this.searchQuery.set(query);
}Observation: The comment mentions avoiding unnecessary rerenders, but signals in Angular already use referential equality checks internally. This check using Suggestion: If the goal is performance, either rely on signal's built-in checks or clarify the comment to explain that deep equality is needed for semantic reasons (not just performance). 🎨 Style & Best PracticesThe code follows Angular best practices well:
📊 Test CoverageThe test suite is excellent with 96% coverage. Tests properly cover:
The only missing coverage appears to be in error paths (the 4 uncovered lines mentioned in Codecov). Overall, this is solid refactoring work that successfully achieves its goals! The issues identified are relatively minor and mostly relate to edge cases and potential future extensibility. The core logic is sound and well-tested. 🎉 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #13033 +/- ##
==========================================
+ Coverage 86.69% 86.77% +0.08%
==========================================
Files 1845 1847 +2
Lines 69324 69378 +54
Branches 8551 8578 +27
==========================================
+ Hits 60097 60206 +109
+ Misses 9227 9172 -55 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Built-in system users (root, daemon, www) should have local: true, not local: false. Only directory service users have local: false.
- Add buildUserTypeFilters() and getDefaultUserTypeFilters() to presets - Remove duplicated filter-building methods from UsersSearchComponent - Use shared function in AllUsersComponent for default params
- Add proper UserTypeFilterExpression type alias for filter expressions - Convert isBuiltinFilterActive and isLocalFilterActive to computed signals - Convert userPresets to computed signal derived from filter state - Replace setTimeout with RxJS Subject + debounceTime for advanced search - Clean up unused imports
AlexKarpov98
left a comment
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 overall, I think some improvements needed thouth ⏬ :
- I think
Filter by Typecan take more space to fit in one line in the select option.
- Switching from basic to advanced differs by search results without any user input.
Screen.Recording.2025-12-31.at.13.25.22.mov
- Would be great to take care of the smaller screens as well at this stage:
AlexKarpov98
left a comment
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.
Perfect, thanks!
|
JIRA ticket https://ixsystems.atlassian.net/browse/NAS-139073 is targeted to the following versions which have not received their corresponding PRs: 25.10.2 |
|
This PR has been merged and conversations have been locked. |


Changes:
Simplify logic overall.
Replace UntilDestroy.
Show Local and DS users by default.
Switch Built-in to a toggle available only when Local is selected.
Do not show "root" user by default.
Screen.Recording.2025-12-29.at.1.36.39.PM.mov
Testing:
Self explanatory, make sure it just works as expected.
Downstream