From 87a0cac618c8ed4a09408273d0f5a468530e8062 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 24 May 2022 15:05:39 +0200 Subject: Improve admin users list table * Fix last login sort with null values * Remember last selected columns * Display last login date by default --- .../users/user-list/user-list.component.html | 2 +- .../users/user-list/user-list.component.ts | 44 +++++++++++++++++----- 2 files changed, 36 insertions(+), 10 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/overview/users/user-list/user-list.component.html b/client/src/app/+admin/overview/users/user-list/user-list.component.html index 30d10e3cf..62eeef8fe 100644 --- a/client/src/app/+admin/overview/users/user-list/user-list.component.html +++ b/client/src/app/+admin/overview/users/user-list/user-list.component.html @@ -5,7 +5,7 @@ c.id) + this.loadSelectedColumns() + } + + loadSelectedColumns () { + const result = this.peertubeLocalStorage.getItem(UserListComponent.LOCAL_STORAGE_SELECTED_COLUMNS_KEY) + + if (result) { + try { + this.selectedColumns = JSON.parse(result) + return + } catch (err) { + console.error('Cannot load selected columns.', err) + } + } + + // Default behaviour + this.selectedColumns = [ 'username', 'role', 'email', 'quota', 'createdAt', 'lastLoginDate' ] + return + } - this.columns.push({ id: 'quotaDaily', label: $localize`Daily quota` }) - this.columns.push({ id: 'pluginAuth', label: $localize`Auth plugin` }) - this.columns.push({ id: 'lastLoginDate', label: $localize`Last login` }) + saveSelectedColumns () { + this.peertubeLocalStorage.setItem(UserListComponent.LOCAL_STORAGE_SELECTED_COLUMNS_KEY, JSON.stringify(this.selectedColumns)) } getIdentifier () { -- cgit v1.2.3