diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-12-08 14:34:17 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-12-08 14:34:17 +0100 |
commit | cd83ea1b908efe594c1e03f886c0dc4742b91360 (patch) | |
tree | 7ce95792ede104e5a761830ecd7aaf3ee19fd8dc /client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts | |
parent | 04e0fc488826f505a8de3ce99113f3cb2fcec147 (diff) | |
download | PeerTube-cd83ea1b908efe594c1e03f886c0dc4742b91360.tar.gz PeerTube-cd83ea1b908efe594c1e03f886c0dc4742b91360.tar.zst PeerTube-cd83ea1b908efe594c1e03f886c0dc4742b91360.zip |
Design admin data 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 | 24 |
1 files changed, 11 insertions, 13 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 88fe259fb..f93847f29 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 | |||
@@ -1,22 +1,24 @@ | |||
1 | import { Component } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { NotificationsService } from 'angular2-notifications' |
3 | import { SortMeta } from 'primeng/primeng' | 3 | import { SortMeta } from 'primeng/primeng' |
4 | import { Job } from '../../../../../../shared/index' | 4 | import { Job } from '../../../../../../shared/index' |
5 | import { RestPagination, RestTable } from '../../../shared' | 5 | import { RestPagination, RestTable } from '../../../shared' |
6 | import { viewportHeight } from '../../../shared/misc/utils' | ||
6 | import { JobService } from '../shared' | 7 | import { JobService } from '../shared' |
7 | import { RestExtractor } from '../../../shared/rest/rest-extractor.service' | 8 | import { RestExtractor } from '../../../shared/rest/rest-extractor.service' |
8 | 9 | ||
9 | @Component({ | 10 | @Component({ |
10 | selector: 'my-jobs-list', | 11 | selector: 'my-jobs-list', |
11 | templateUrl: './jobs-list.component.html', | 12 | templateUrl: './jobs-list.component.html', |
12 | styleUrls: [ ] | 13 | styleUrls: [ './jobs-list.component.scss' ] |
13 | }) | 14 | }) |
14 | export class JobsListComponent extends RestTable { | 15 | export class JobsListComponent extends RestTable implements OnInit { |
15 | jobs: Job[] = [] | 16 | jobs: Job[] = [] |
16 | totalRecords = 0 | 17 | totalRecords = 0 |
17 | rowsPerPage = 10 | 18 | rowsPerPage = 20 |
18 | sort: SortMeta = { field: 'createdAt', order: 1 } | 19 | sort: SortMeta = { field: 'createdAt', order: 1 } |
19 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 20 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
21 | scrollHeight = '' | ||
20 | 22 | ||
21 | constructor ( | 23 | constructor ( |
22 | private notificationsService: NotificationsService, | 24 | private notificationsService: NotificationsService, |
@@ -26,10 +28,14 @@ export class JobsListComponent extends RestTable { | |||
26 | super() | 28 | super() |
27 | } | 29 | } |
28 | 30 | ||
31 | ngOnInit () { | ||
32 | // 270 -> headers + footer... | ||
33 | this.scrollHeight = (viewportHeight() - 380) + 'px' | ||
34 | } | ||
35 | |||
29 | protected loadData () { | 36 | protected loadData () { |
30 | this.jobsService | 37 | this.jobsService |
31 | .getJobs(this.pagination, this.sort) | 38 | .getJobs(this.pagination, this.sort) |
32 | .map(res => this.restExtractor.applyToResultListData(res, this.formatJob.bind(this))) | ||
33 | .subscribe( | 39 | .subscribe( |
34 | resultList => { | 40 | resultList => { |
35 | this.jobs = resultList.data | 41 | this.jobs = resultList.data |
@@ -39,12 +45,4 @@ export class JobsListComponent extends RestTable { | |||
39 | err => this.notificationsService.error('Error', err.message) | 45 | err => this.notificationsService.error('Error', err.message) |
40 | ) | 46 | ) |
41 | } | 47 | } |
42 | |||
43 | private formatJob (job: Job) { | ||
44 | const handlerInputData = JSON.stringify(job.handlerInputData) | ||
45 | |||
46 | return Object.assign(job, { | ||
47 | handlerInputData | ||
48 | }) | ||
49 | } | ||
50 | } | 48 | } |