65 lines
2.2 KiB
TypeScript
65 lines
2.2 KiB
TypeScript
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
import { LazyLoadEvent } from 'primeng/api';
|
|
import { Page } from 'src/app/shared/models/paging/page.interface';
|
|
import { SystemException } from 'src/app/shared/models/system-exception.interface';
|
|
import { ApplicationLevelExceptionService } from 'src/app/shared/services/administration/application-level-exception.service';
|
|
import { ErrorHandlingService } from 'src/app/shared/services/error-handling/error-handling.service';
|
|
|
|
@Component({
|
|
selector: 'app-application-level-table',
|
|
templateUrl: './application-level-table.component.html',
|
|
styleUrls: ['./application-level-table.component.scss']
|
|
})
|
|
export class ApplicationLevelTableComponent implements OnInit {
|
|
|
|
@Output() paginationEvent = new EventEmitter<{ page: number, offset: number }>(); // TODO: Use interface.
|
|
@Input() loading: boolean;
|
|
@Input() set searchResultsPage(results: Page<SystemException>) {
|
|
|
|
// This setter may be called on page setup without arguments.
|
|
if (!results) {
|
|
return;
|
|
}
|
|
|
|
this._searchResultsPage = results;
|
|
this.totalRecords = results.totalElements;
|
|
// this.loading = false;
|
|
}
|
|
_searchResultsPage: Page<SystemException>;
|
|
totalRecords: number;
|
|
rows: number = 10;
|
|
header: string;
|
|
trace: string;
|
|
displayTraceDialog: boolean;
|
|
|
|
constructor(private errorHandlingService: ErrorHandlingService, private applicationLevelService: ApplicationLevelExceptionService) { }
|
|
|
|
ngOnInit(): void {
|
|
}
|
|
|
|
onLazyLoad(event: LazyLoadEvent) {
|
|
let pageToRequest = Math.floor(event.first / event.rows);
|
|
let pageSize = event.rows;
|
|
this.paginationEvent.emit({ page: pageToRequest, offset: pageSize });
|
|
}
|
|
|
|
edit(id: number) {
|
|
this.header = "Trace";
|
|
if(id){
|
|
this.applicationLevelService.getById(id).subscribe(result => {
|
|
this.trace = result.trace;
|
|
this.displayTraceDialog = true;
|
|
},
|
|
err => {
|
|
this.errorHandlingService.showHttpResponseError(err)
|
|
});
|
|
}
|
|
}
|
|
|
|
cancelEditLevelException() {
|
|
this.displayTraceDialog = false;
|
|
this.trace = null;
|
|
}
|
|
}
|