From ab998f7b6dffbe461d830d3696cb46491ad6afb0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 23 Feb 2018 14:36:16 +0100 Subject: Improve admin tables --- client/src/app/+admin/admin.module.ts | 4 +- .../followers-list/followers-list.component.html | 35 ++++++++++---- .../followers-list/followers-list.component.ts | 8 +++- .../following-list/following-list.component.html | 38 ++++++++++----- .../following-list/following-list.component.ts | 8 +++- .../+admin/jobs/jobs-list/jobs-list.component.html | 52 ++++++++++++++------ .../+admin/jobs/jobs-list/jobs-list.component.ts | 22 +++++++-- .../users/user-list/user-list.component.html | 44 ++++++++++------- .../+admin/users/user-list/user-list.component.ts | 10 ++-- .../video-abuse-list.component.html | 37 ++++++++------ .../video-abuse-list/video-abuse-list.component.ts | 8 ++-- .../video-blacklist-list.component.html | 56 +++++++++++++--------- .../video-blacklist-list.component.ts | 8 ++-- 13 files changed, 220 insertions(+), 110 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/admin.module.ts b/client/src/app/+admin/admin.module.ts index 1d9120490..b389f3d4f 100644 --- a/client/src/app/+admin/admin.module.ts +++ b/client/src/app/+admin/admin.module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core' import { ConfigComponent, EditCustomConfigComponent } from '@app/+admin/config' import { ConfigService } from '@app/+admin/config/shared/config.service' import { TabsModule } from 'ngx-bootstrap/tabs' -import { DataTableModule } from 'primeng/components/datatable/datatable' +import { TableModule } from 'primeng/table' import { SharedModule } from '../shared' import { AdminRoutingModule } from './admin-routing.module' import { AdminComponent } from './admin.component' @@ -19,7 +19,7 @@ import { VideoBlacklistComponent, VideoBlacklistListComponent } from './video-bl imports: [ AdminRoutingModule, TabsModule.forRoot(), - DataTableModule, + TableModule, SharedModule ], diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.html b/client/src/app/+admin/follows/followers-list/followers-list.component.html index 74f2c2e36..85d2a2cf6 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.html +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.html @@ -1,11 +1,26 @@ - - - - - - - - + + + ID + Score + Name + Host + State + Created + + + + + + {{ follow.id }} + {{ follow.score }} + {{ follow.follower.name }} + {{ follow.follower.host }} + {{ follow.state }} + {{ follow.createdAt }} + + + diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts index 649815709..69b3e5e58 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core' +import { Component, OnInit } from '@angular/core' import { NotificationsService } from 'angular2-notifications' import { SortMeta } from 'primeng/primeng' @@ -11,7 +11,7 @@ import { FollowService } from '../shared' templateUrl: './followers-list.component.html', styleUrls: [ './followers-list.component.scss' ] }) -export class FollowersListComponent extends RestTable { +export class FollowersListComponent extends RestTable implements OnInit { followers: AccountFollow[] = [] totalRecords = 0 rowsPerPage = 10 @@ -25,6 +25,10 @@ export class FollowersListComponent extends RestTable { super() } + ngOnInit () { + this.loadSort() + } + protected loadData () { this.followService.getFollowers(this.pagination, this.sort) .subscribe( diff --git a/client/src/app/+admin/follows/following-list/following-list.component.html b/client/src/app/+admin/follows/following-list/following-list.component.html index fc1cf0dc4..24981d3e9 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.html +++ b/client/src/app/+admin/follows/following-list/following-list.component.html @@ -1,14 +1,26 @@ - - - - - - - - - - - + + + ID + Host + State + Created + + + + + + + {{ follow.id }} + {{ follow.following.host }} + {{ follow.state }} + {{ follow.createdAt }} + + + + + + diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts index ad1bd4536..873a5d965 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.ts +++ b/client/src/app/+admin/follows/following-list/following-list.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core' +import { Component, OnInit } from '@angular/core' import { NotificationsService } from 'angular2-notifications' import { SortMeta } from 'primeng/primeng' import { AccountFollow } from '../../../../../../shared/models/actors/follow.model' @@ -10,7 +10,7 @@ import { FollowService } from '../shared' selector: 'my-followers-list', templateUrl: './following-list.component.html' }) -export class FollowingListComponent extends RestTable { +export class FollowingListComponent extends RestTable implements OnInit { following: AccountFollow[] = [] totalRecords = 0 rowsPerPage = 10 @@ -25,6 +25,10 @@ export class FollowingListComponent extends RestTable { super() } + ngOnInit () { + this.loadSort() + } + async removeFollowing (follow: AccountFollow) { const res = await this.confirmService.confirm(`Do you really want to unfollow ${follow.following.host}?`, 'Unfollow') if (res === false) return diff --git a/client/src/app/+admin/jobs/jobs-list/jobs-list.component.html b/client/src/app/+admin/jobs/jobs-list/jobs-list.component.html index f1b14e5e3..87717d3dd 100644 --- a/client/src/app/+admin/jobs/jobs-list/jobs-list.component.html +++ b/client/src/app/+admin/jobs/jobs-list/jobs-list.component.html @@ -8,20 +8,42 @@ + + + + + ID + Type + State + Created + Updated + + + + + + + + + + {{ job.id }} + {{ job.type }} + {{ job.state }} + {{ job.createdAt }} + {{ job.updatedAt }} + + + + + + +
{{ job.data }}
+ + +
+
- - - - - - -
{{ job.data }}
-
-
- - -
diff --git a/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts b/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts index 7de6f70d2..80aba9f3a 100644 --- a/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts +++ b/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts @@ -14,11 +14,13 @@ import { RestExtractor } from '../../../shared/rest/rest-extractor.service' styleUrls: [ './jobs-list.component.scss' ] }) export class JobsListComponent extends RestTable implements OnInit { + private static JOB_STATE_LOCAL_STORAGE_STATE = 'jobs-list-state' + jobState: JobState = 'inactive' jobStates: JobState[] = [ 'active', 'complete', 'failed', 'inactive', 'delayed' ] jobs: Job[] = [] - totalRecords = 0 - rowsPerPage = 20 + totalRecords: number + rowsPerPage = 10 sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } scrollHeight = '' @@ -32,12 +34,16 @@ export class JobsListComponent extends RestTable implements OnInit { } ngOnInit () { - // 270 -> headers + footer... + // 380 -> headers + footer... this.scrollHeight = (viewportHeight() - 380) + 'px' + + this.loadJobState() + this.loadSort() } onJobStateChanged () { this.loadData() + this.saveJobState() } protected loadData () { @@ -52,4 +58,14 @@ export class JobsListComponent extends RestTable implements OnInit { err => this.notificationsService.error('Error', err.message) ) } + + private loadJobState () { + const result = localStorage.getItem(JobsListComponent.JOB_STATE_LOCAL_STORAGE_STATE) + + if (result) this.jobState = result as JobState + } + + private saveJobState () { + localStorage.setItem(JobsListComponent.JOB_STATE_LOCAL_STORAGE_STATE, this.jobState) + } } diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index 08f4caeb9..8dbe9ddc4 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html @@ -7,20 +7,32 @@ - - - - - - - - - - - - - - + + + Username + Email + Video quota + Role + Created + + + + + + + {{ user.username }} + {{ user.email }} + {{ user.videoQuota }} + {{ user.roleLabel }} + {{ user.createdAt }} + + + + + + + diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 512152808..a52df49c0 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core' +import { Component, OnInit } from '@angular/core' import { NotificationsService } from 'angular2-notifications' import { SortMeta } from 'primeng/components/common/sortmeta' @@ -12,11 +12,11 @@ import { UserService } from '../shared' templateUrl: './user-list.component.html', styleUrls: [ './user-list.component.scss' ] }) -export class UserListComponent extends RestTable { +export class UserListComponent extends RestTable implements OnInit { users: User[] = [] totalRecords = 0 rowsPerPage = 10 - sort: SortMeta = { field: 'id', order: 1 } + sort: SortMeta = { field: 'createdAt', order: 1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } constructor ( @@ -27,6 +27,10 @@ export class UserListComponent extends RestTable { super() } + ngOnInit () { + this.loadSort() + } + async removeUser (user: User) { if (user.username === 'root') { this.notificationsService.error('Error', 'You cannot delete root.') diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html index 65d061246..2779db5bc 100644 --- a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html +++ b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html @@ -2,18 +2,27 @@
Video abuses list
- - - - - - - - - {{ videoAbuse.videoName }} - - - + + + Reason + Reporter + Created + Video + + + + + + {{ videoAbuse.reason }} + {{ videoAbuse.reporterServerHost + '@' + videoAbuse.reporterUsername }} + {{ videoAbuse.createdAt }} + + {{ videoAbuse.videoName }} + + + + diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts index b4d3bbd24..bf9483f34 100644 --- a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts @@ -15,7 +15,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { videoAbuses: VideoAbuse[] = [] totalRecords = 0 rowsPerPage = 10 - sort: SortMeta = { field: 'id', order: 1 } + sort: SortMeta = { field: 'createdAt', order: 1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } constructor ( @@ -26,11 +26,11 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { } ngOnInit () { - this.loadData() + this.loadSort() } - getRouterVideoLink (videoId: number) { - return [ '/videos', videoId ] + getRouterVideoLink (videoUUID: string) { + return [ '/videos', videoUUID ] } protected loadData () { diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html index 942f7c9f1..ac30cec39 100644 --- a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html @@ -1,23 +1,35 @@ -
-
-

Blacklisted videos

- - - - - - - - - - - - - - - -
+
+
Blacklisted videos
+ + + + + Name + Description + Views + NSFW + UUID + Created + + + + + + + {{ videoBlacklist.name }} + {{ videoBlacklist.description }} + {{ videoBlacklist.views }} + {{ videoBlacklist.nsfw }} + {{ videoBlacklist.uuid }} + {{ videoBlacklist.createdAt }} + + + + + + + diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts index f4cf21259..7210e677c 100644 --- a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts @@ -16,7 +16,7 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { blacklist: BlacklistedVideo[] = [] totalRecords = 0 rowsPerPage = 10 - sort: SortMeta = { field: 'id', order: 1 } + sort: SortMeta = { field: 'createdAt', order: 1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } constructor ( @@ -28,13 +28,13 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { } ngOnInit () { - this.loadData() + this.loadSort() } async removeVideoFromBlacklist (entry: BlacklistedVideo) { - const confirmMessage = 'Do you really want to remove this video from the blacklist ? It will be available again in the video list.' + const confirmMessage = 'Do you really want to remove this video from the blacklist ? It will be available again in the videos list.' - const res = await this.confirmService.confirm(confirmMessage, 'Remove') + const res = await this.confirmService.confirm(confirmMessage, 'Unblacklist') if (res === false) return this.videoBlacklistService.removeVideoFromBlacklist(entry.videoId).subscribe( -- cgit v1.2.3