search.component.ts 1022 Bytes
Newer Older
Vitali Stupin's avatar
Initial    
Vitali Stupin committed
1
import { Component, OnInit } from '@angular/core';
Vitali Stupin's avatar
Vitali Stupin committed
2
import { SubsystemsService } from '../../subsystems.service';
Vitali Stupin's avatar
Initial    
Vitali Stupin committed
3
4
5

@Component({
  selector: 'app-search',
Vitali Stupin's avatar
Vitali Stupin committed
6
  templateUrl: './search.component.html'
Vitali Stupin's avatar
Initial    
Vitali Stupin committed
7
8
})
export class SearchComponent implements OnInit {
Vitali Stupin's avatar
Vitali Stupin committed
9
  limit: string;
10
  limits: object;
Vitali Stupin's avatar
Vitali Stupin committed
11
12
  nonEmpty: boolean;
  filter: string;
Vitali Stupin's avatar
Vitali Stupin committed
13

14
15
16
17
18
19
20
21
  constructor(private subsystemsService: SubsystemsService) {
    this.limit = this.subsystemsService.getLimit();
    this.limits = this.subsystemsService.getLimits();
  }

  getLimitKeys(): string[] {
    return Object.keys(this.limits);
  }
Vitali Stupin's avatar
Initial    
Vitali Stupin committed
22

Vitali Stupin's avatar
Vitali Stupin committed
23
  setNonEmpty(nonEmpty: boolean) {
Vitali Stupin's avatar
Vitali Stupin committed
24
    this.subsystemsService.setNonEmpty(nonEmpty);
Vitali Stupin's avatar
Vitali Stupin committed
25
26
27
  }

  setLimit(limit: string) {
28
    this.limit = limit;
Vitali Stupin's avatar
Vitali Stupin committed
29
    this.subsystemsService.setLimit(limit);
Vitali Stupin's avatar
Vitali Stupin committed
30
31
32
  }

  setFilter(filter: string) {
Vitali Stupin's avatar
Vitali Stupin committed
33
    this.subsystemsService.setFilter(filter);
Vitali Stupin's avatar
Vitali Stupin committed
34
35
  }

Vitali Stupin's avatar
Vitali Stupin committed
36
  ngOnInit() {
Vitali Stupin's avatar
Vitali Stupin committed
37
38
39
    this.limit = this.subsystemsService.getLimit();
    this.nonEmpty = this.subsystemsService.getNonEmpty();
    this.filter = this.subsystemsService.getfilter();
Vitali Stupin's avatar
Vitali Stupin committed
40
  }
Vitali Stupin's avatar
Initial    
Vitali Stupin committed
41
}