1 import { Component, OnInit } from '@angular/core'
2 import { NotificationsService } from 'angular2-notifications'
3 import { SortMeta } from 'primeng/primeng'
4 import { Job } from '../../../../../../shared/index'
5 import { RestPagination, RestTable } from '../../../shared'
6 import { viewportHeight } from '../../../shared/misc/utils'
7 import { JobService } from '../shared'
8 import { RestExtractor } from '../../../shared/rest/rest-extractor.service'
11 selector: 'my-jobs-list',
12 templateUrl: './jobs-list.component.html',
13 styleUrls: [ './jobs-list.component.scss' ]
15 export class JobsListComponent extends RestTable implements OnInit {
19 sort: SortMeta = { field: 'createdAt', order: 1 }
20 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
24 private notificationsService: NotificationsService,
25 private restExtractor: RestExtractor,
26 private jobsService: JobService
32 // 270 -> headers + footer...
33 this.scrollHeight = (viewportHeight() - 380) + 'px'
36 protected loadData () {
38 .getJobs(this.pagination, this.sort)
41 this.jobs = resultList.data
42 this.totalRecords = resultList.total
45 err => this.notificationsService.error('Error', err.message)