aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts
diff options
context:
space:
mode:
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.ts22
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})
16export class JobsListComponent extends RestTable implements OnInit { 16export 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}