|
|
@@ -4,7 +4,10 @@ import {
|
|
|
FilterNotificate,
|
|
|
FilterRequest,
|
|
|
FilterWorkflow,
|
|
|
+ ResponseDataWorkflowExecutionHistory,
|
|
|
} from '../../../interfaces/process-managementv/workflow-management.interface';
|
|
|
+import { WorkflowExecutionHistoryComponent } from '../workflow-management/workflow-execution-history/workflow-execution-history.component';
|
|
|
+import { HttpErrorResponse } from '@angular/common/http';
|
|
|
import { MatPaginator } from '@angular/material/paginator';
|
|
|
import { MatSort } from '@angular/material/sort';
|
|
|
import { ResourcesService } from '../../../services/resources.service';
|
|
|
@@ -15,6 +18,8 @@ import { Router } from '@angular/router';
|
|
|
import { SearchRequestComponent } from './search-request/search-request.component';
|
|
|
import { SearchNotificateComponent } from './search-notificate/search-notificate.component';
|
|
|
import { SearchWorkflowComponent } from './search-workflow/search-workflow.component';
|
|
|
+import { ProcessManagementService } from '../../../services/process-management/process-management.service';
|
|
|
+import { lastValueFrom } from 'rxjs';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-multicriteria-searches',
|
|
|
@@ -48,7 +53,8 @@ export class MulticriteriaSearchesComponent implements AfterViewInit {
|
|
|
public interService: InternationalizationService,
|
|
|
private _dialog: MatDialog,
|
|
|
private _encService: EncService,
|
|
|
- private _router: Router
|
|
|
+ private _router: Router,
|
|
|
+ private _processManagementService: ProcessManagementService
|
|
|
) {
|
|
|
this.isLoadingRequest = false;
|
|
|
this.isLoadingNotificate = false;
|
|
|
@@ -75,7 +81,7 @@ export class MulticriteriaSearchesComponent implements AfterViewInit {
|
|
|
|
|
|
this.dataSourceWorkflow = new MatTableDataSource<FilterWorkflow>();
|
|
|
this.displayedColumnsWorkflow = [
|
|
|
- 'ID_WORKFLOW',
|
|
|
+ 'CONTADOR',
|
|
|
'NOMBRE_WORKFLOW',
|
|
|
'DESC_WORKFLOW',
|
|
|
'ESTADO_WORKFLOW',
|
|
|
@@ -116,8 +122,6 @@ export class MulticriteriaSearchesComponent implements AfterViewInit {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
public openSearchNotificate() {
|
|
|
this._dialog
|
|
|
.open(SearchNotificateComponent, {
|
|
|
@@ -156,7 +160,38 @@ export class MulticriteriaSearchesComponent implements AfterViewInit {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- public viewWorkflowHistory(filterWorkflow: FilterWorkflow) {
|
|
|
- console.log('Ver historial del workflow ID:', filterWorkflow.ID_WORKFLOW);
|
|
|
+ public async viewWorkflowHistory(filterWorkflow: FilterWorkflow) {
|
|
|
+ this.isLoadingForm = true;
|
|
|
+ const user = this.resourcesService.getUser();
|
|
|
+ const line = this.resourcesService.getLineNumber();
|
|
|
+
|
|
|
+ await lastValueFrom(
|
|
|
+ this._processManagementService.getWorkflowExecutionsHistory(
|
|
|
+ filterWorkflow.ID_WORKFLOW.toString(),
|
|
|
+ user,
|
|
|
+ line
|
|
|
+ )
|
|
|
+ ).then(
|
|
|
+ (responseData: ResponseDataWorkflowExecutionHistory) => {
|
|
|
+ if (!responseData.error) {
|
|
|
+ this._dialog.open(WorkflowExecutionHistoryComponent, {
|
|
|
+ disableClose: true,
|
|
|
+ width: '900px',
|
|
|
+ maxWidth: '90vw',
|
|
|
+ maxHeight: '90vh',
|
|
|
+ data: { historyData: responseData.response },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.resourcesService.openSnackBar(`${responseData.msg}`);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async (httpErrorResponse: HttpErrorResponse) => {
|
|
|
+ let response = this.resourcesService.checkErrors(httpErrorResponse);
|
|
|
+ if (response !== null && response.reload) {
|
|
|
+ await this.viewWorkflowHistory(filterWorkflow);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ this.isLoadingForm = false;
|
|
|
}
|
|
|
}
|