diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-23 14:36:16 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-23 14:36:16 +0100 |
commit | ab998f7b6dffbe461d830d3696cb46491ad6afb0 (patch) | |
tree | f819e4049ca62b5389fd31ebfcbcb6ffbe0eaf0b /client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts | |
parent | 621d99f53f47a11919ec243e05273ecf5907b444 (diff) | |
download | PeerTube-ab998f7b6dffbe461d830d3696cb46491ad6afb0.tar.gz PeerTube-ab998f7b6dffbe461d830d3696cb46491ad6afb0.tar.zst PeerTube-ab998f7b6dffbe461d830d3696cb46491ad6afb0.zip |
Improve admin tables
Diffstat (limited to 'client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts')
-rw-r--r-- | client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts | 22 |
1 files changed, 19 insertions, 3 deletions
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' | |||
14 | styleUrls: [ './jobs-list.component.scss' ] | 14 | styleUrls: [ './jobs-list.component.scss' ] |
15 | }) | 15 | }) |
16 | export class JobsListComponent extends RestTable implements OnInit { | 16 | export class JobsListComponent extends RestTable implements OnInit { |
17 | private static JOB_STATE_LOCAL_STORAGE_STATE = 'jobs-list-state' | ||
18 | |||
17 | jobState: JobState = 'inactive' | 19 | jobState: JobState = 'inactive' |
18 | jobStates: JobState[] = [ 'active', 'complete', 'failed', 'inactive', 'delayed' ] | 20 | jobStates: JobState[] = [ 'active', 'complete', 'failed', 'inactive', 'delayed' ] |
19 | jobs: Job[] = [] | 21 | jobs: Job[] = [] |
20 | totalRecords = 0 | 22 | totalRecords: number |
21 | rowsPerPage = 20 | 23 | rowsPerPage = 10 |
22 | sort: SortMeta = { field: 'createdAt', order: -1 } | 24 | sort: SortMeta = { field: 'createdAt', order: -1 } |
23 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 25 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
24 | scrollHeight = '' | 26 | scrollHeight = '' |
@@ -32,12 +34,16 @@ export class JobsListComponent extends RestTable implements OnInit { | |||
32 | } | 34 | } |
33 | 35 | ||
34 | ngOnInit () { | 36 | ngOnInit () { |
35 | // 270 -> headers + footer... | 37 | // 380 -> headers + footer... |
36 | this.scrollHeight = (viewportHeight() - 380) + 'px' | 38 | this.scrollHeight = (viewportHeight() - 380) + 'px' |
39 | |||
40 | this.loadJobState() | ||
41 | this.loadSort() | ||
37 | } | 42 | } |
38 | 43 | ||
39 | onJobStateChanged () { | 44 | onJobStateChanged () { |
40 | this.loadData() | 45 | this.loadData() |
46 | this.saveJobState() | ||
41 | } | 47 | } |
42 | 48 | ||
43 | protected loadData () { | 49 | protected loadData () { |
@@ -52,4 +58,14 @@ export class JobsListComponent extends RestTable implements OnInit { | |||
52 | err => this.notificationsService.error('Error', err.message) | 58 | err => this.notificationsService.error('Error', err.message) |
53 | ) | 59 | ) |
54 | } | 60 | } |
61 | |||
62 | private loadJobState () { | ||
63 | const result = localStorage.getItem(JobsListComponent.JOB_STATE_LOCAL_STORAGE_STATE) | ||
64 | |||
65 | if (result) this.jobState = result as JobState | ||
66 | } | ||
67 | |||
68 | private saveJobState () { | ||
69 | localStorage.setItem(JobsListComponent.JOB_STATE_LOCAL_STORAGE_STATE, this.jobState) | ||
70 | } | ||
55 | } | 71 | } |