1
|
import {Component, OnInit, ViewChild} from '@angular/core';
|
2
|
import {FileDownloadSearchComponent} from './file-download-search/file-download-search.component';
|
3
|
import {FileDownloadRealTimeMonitorComponent} from './file-download-real-time-monitor/file-download-real-time-monitor.component';
|
4
|
import { RealTimeExecution } from 'src/app/shared/models/real-time-execution.interface';
|
5
|
import { AuthService } from 'src/app/shared/services/auth.service';
|
6
|
import { environment } from 'src/environments/environment';
|
7
|
import { USER_RIGHTS } from 'src/app/shared/enums/USER_RIGHTS.enum';
|
8
|
|
9
|
@Component({
|
10
|
selector: 'app-file-download-scheduler',
|
11
|
templateUrl: './file-download-scheduler.component.html',
|
12
|
styleUrls: ['./file-download-scheduler.component.scss']
|
13
|
})
|
14
|
export class FileDownloadSchedulerComponent implements OnInit {
|
15
|
get fileDownloadMonitoringTable(): FileDownloadRealTimeMonitorComponent {
|
16
|
return this._fileDownloadMonitoringTable;
|
17
|
}
|
18
|
|
19
|
@ViewChild(FileDownloadRealTimeMonitorComponent, {static: false})
|
20
|
set fileDownloadMonitoringTable(value: FileDownloadRealTimeMonitorComponent) {
|
21
|
if (value) {
|
22
|
this._fileDownloadMonitoringTable = value;
|
23
|
this._fileDownloadMonitoringTable.searchByCriteria(
|
24
|
this.fileDownloadSearch.searchFilter.value);
|
25
|
}
|
26
|
}
|
27
|
|
28
|
searchFilter: any;
|
29
|
executionInfo: RealTimeExecution;
|
30
|
|
31
|
@ViewChild(FileDownloadSearchComponent, {static: true})
|
32
|
fileDownloadSearch: FileDownloadSearchComponent;
|
33
|
|
34
|
private _fileDownloadMonitoringTable: FileDownloadRealTimeMonitorComponent;
|
35
|
|
36
|
constructor(private authService: AuthService) {
|
37
|
}
|
38
|
|
39
|
ngOnInit(): void {
|
40
|
}
|
41
|
|
42
|
searchByCriteria(): void {
|
43
|
this.searchFilter = this.fileDownloadSearch.searchFilter.value;
|
44
|
if (this.fileDownloadMonitoringTable) {
|
45
|
this._fileDownloadMonitoringTable.searchByCriteria(
|
46
|
this.fileDownloadSearch.searchFilter.value);
|
47
|
}
|
48
|
}
|
49
|
|
50
|
clear() {
|
51
|
this.fileDownloadSearch.resetForm();
|
52
|
}
|
53
|
|
54
|
public passData(executionInfo: RealTimeExecution): void {
|
55
|
console.log(executionInfo);
|
56
|
this.executionInfo = executionInfo;
|
57
|
}
|
58
|
|
59
|
canPreviewAll() : boolean {
|
60
|
return this.authService.userHasRightForClient(USER_RIGHTS.A02, environment.globalRightsClientID);
|
61
|
}
|
62
|
|
63
|
canPreviewByUA() : boolean {
|
64
|
return this.authService.userRights.find(rdc => USER_RIGHTS.A03.isGrantedToUser(rdc.rights)) != null;
|
65
|
}
|
66
|
}
|