aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.ts
blob: 4d89750f902bce661c634920c68c87f390ca3821 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import {Component, OnDestroy, OnInit} from "@angular/core";
import {DialogComponent, DialogService} from "ng2-bootstrap-modal";
import {IframeService} from "../../../utils/iframe.service";
import {ActivatedRoute} from "@angular/router";
import {ServiceInfoService} from "../../../server/serviceInfo/serviceInfo.service";
import {InstantiationTemplatesModalService} from "./instantiation.templates.modal.service";
import {InstantiationTemplatesRowModel} from "./instantiation.templates.row.model";

@Component({
  selector: 'template-modal',
  templateUrl: 'instantiation.templates.modal.component.html',
  styleUrls: ['instantiation.templates.modal.component.scss']
})

export class InstantiationTemplatesModalComponent extends DialogComponent<string, boolean> implements OnInit, OnDestroy {

  selectedJobId : string = null;
  templateModalComponentService: InstantiationTemplatesModalService;
  originalTableData: InstantiationTemplatesRowModel[] = [];
  filterTableData : InstantiationTemplatesRowModel[] = [];
  filterText: string;

  constructor(dialogService: DialogService,
              private _iframeService: IframeService,
              private _serviceInfoService: ServiceInfoService,
              private _templateModalComponentService: InstantiationTemplatesModalService,
              private _route: ActivatedRoute) {
    super(dialogService);
    this.templateModalComponentService = _templateModalComponentService;
  }

  ngOnInit(): void {
    this.filterText = '';
    this._route
      .queryParams
      .subscribe(params => {
        this._serviceInfoService.getServicesJobInfo(true, params['serviceModelId']).subscribe((jobs) => {
          this.originalTableData = this._templateModalComponentService.convertResponseToUI(jobs);
          this.filterTableData = this.originalTableData;
        });
      });
  }

  loadTemplate = () => {

  };


  closeModal(): void {
    this._iframeService.removeClassCloseModal('content');
    this.dialogService.removeDialog(this);
    setTimeout(() => {
      window.parent.postMessage("closeIframe", "*");
    }, 15);

  }
}