This is an automated email from the ASF dual-hosted git repository.
aicam pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/main by this push:
new 4b9e0d08e3 feat: introduce sort by activeness to admin dashboard
(#3960)
4b9e0d08e3 is described below
commit 4b9e0d08e3ded14c25c4da6d1c00b58c67b0f17f
Author: Jaeyun Kim <[email protected]>
AuthorDate: Mon Oct 20 13:40:32 2025 -0700
feat: introduce sort by activeness to admin dashboard (#3960)
### What changes were proposed in this PR?
In this PR we introduce a new sort feature to the avatar column in admin
dashboard. By clicking at the sort button right next to "Avatar" text,
admin user can view users who are active/inactive.
Reused the sort button from other columns. In case of ties, the original
order of the users is preserved.
Ascending Sorting (Active Users First):
<img width="812" height="659" alt="image"
src="https://github.com/user-attachments/assets/463b2aa1-7cb0-40d2-8b4a-aaa08452d473"
/>
Descending Sorting (Inactive Users First):
<img width="693" height="631" alt="image"
src="https://github.com/user-attachments/assets/d2468b47-b71f-43e0-a6e2-2d8801c1c7c4"
/>
### How was this PR tested?
Did not include test for this PR as it is about sorting users by
active/inactive.
### Was this PR authored or co-authored using generative AI tooling?
No.
---
.../app/dashboard/component/admin/user/admin-user.component.html | 6 +++++-
.../app/dashboard/component/admin/user/admin-user.component.ts | 8 ++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git
a/frontend/src/app/dashboard/component/admin/user/admin-user.component.html
b/frontend/src/app/dashboard/component/admin/user/admin-user.component.html
index 8e59e0d4c8..c2fe74d480 100644
--- a/frontend/src/app/dashboard/component/admin/user/admin-user.component.html
+++ b/frontend/src/app/dashboard/component/admin/user/admin-user.component.html
@@ -31,7 +31,11 @@
[nzData]="listOfDisplayUser">
<thead>
<tr>
- <th>Avatar</th>
+ <th
+ [nzSortFn]="sortByActive"
+ [nzSortDirections]="['ascend', 'descend']">
+ Avatar
+ </th>
<th
[nzSortFn]="sortByID"
[nzSortDirections]="['ascend', 'descend']">
diff --git
a/frontend/src/app/dashboard/component/admin/user/admin-user.component.ts
b/frontend/src/app/dashboard/component/admin/user/admin-user.component.ts
index ecadc3b32c..3e2ced2713 100644
--- a/frontend/src/app/dashboard/component/admin/user/admin-user.component.ts
+++ b/frontend/src/app/dashboard/component/admin/user/admin-user.component.ts
@@ -204,6 +204,14 @@ export class AdminUserComponent implements OnInit {
return user.accountCreation * 1000;
}
+ sortByActive: NzTableSortFn<User> = (a: User, b: User) => {
+ const aActive = this.isUserActive(a);
+ const bActive = this.isUserActive(b);
+
+ if (aActive === bActive) return 0;
+ return aActive ? -1 : 1;
+ };
+
public filterByRole: NzTableFilterFn<User> = (list: string[], user: User) =>
list.some(role => user.role.indexOf(role) !== -1);
}