Project

General

Profile

« Previous | Next » 

Revision 53117

almost ready for review

View differences:

metrics-usagestats-report-results.component.ts
4 4
import { UsagestatsService } from '../../services/usagestats.service';
5 5
import { ReportResponse } from '../../domain/usageStatsClasses';
6 6
import {ar1_report_results} from "../../domain/sushilite_demo_data/AR1_ex";
7
import { FormBuilder, FormGroup } from '@angular/forms';
7 8

  
8 9
@Component({
9 10
  selector: 'metrics-usagestats-report-results',
10
  templateUrl: 'metrics-usagestats-report-results.component.html'
11
  templateUrl: 'metrics-usagestats-report-results.component.html',
12
  styleUrls:['metrics-usagestats-report-results.component.css']
11 13
})
12 14
export class MetricsUsagestatsReportResultsComponent implements OnInit {
13 15

  
......
23 25
  totalPages:number;
24 26
  selectedItemIndex: number;
25 27

  
28
  pageSizeSelect: FormGroup;
29

  
26 30
  constructor(private route: ActivatedRoute,
27 31
              private authService: AuthenticationService,
28
              private usageService: UsagestatsService) {}
32
              private usageService: UsagestatsService,
33
              private fb: FormBuilder) {}
29 34

  
30 35
  ngOnInit() {
31 36
    this.page = 0;
32 37
    this.pageSize = 10;
33 38
    this.readParams();
39
    this.pageSizeSelect = this.fb.group({selectPageSize: ['']});
34 40
  }
35 41

  
36 42
  readParams() {
......
70 76
        this.errorMessage = '';
71 77
        this.loadingMessage = '';
72 78

  
79
        this.pageSizeSelect.get('selectPageSize').setValue(this.pageSize);
80
        this.pageSizeSelect.get('selectPageSize').updateValueAndValidity();
81

  
73 82
        this.totalPages = Math.ceil(
74 83
          +this.repoResponse.ReportDefinition.Filters
75 84
                  .ReportAttribute.filter(x => x['Name'] === 'ReportItemCount')[0].Value / this.pageSize);
......
101 110
  }
102 111

  
103 112

  
104
  getPageSize(num: string){
105
    this.pageSize = +num;
113
  getPageSize(){
114
    this.pageSize = +(this.pageSizeSelect.get('selectPageSize').value);
106 115
    this.page = 0;
107 116
    this.getReportResponse();
108 117
  }

Also available in: Unified diff