mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3586] Add processInstanceId input and fix empty response (#3916)
* [ADF-3586] Add processInstanceId input and fix empty response * [ADF-3586] Fix Task Details Model * [ADF-3586] Fix Dates on ProcessList Component * [ADF-3586] Fix Task Details Model * [ADF-3586] Fix attach form unit tests * [ADF-3586] Fix moment.js import * [ADF-3586] Remove fdescribe * [ADF-3586] Fix Attach Form Component unit test
This commit is contained in:
committed by
Eugenio Romano
parent
f0dff4d011
commit
3d0c7449b4
@@ -17,7 +17,7 @@
|
||||
|
||||
import { AlfrescoApiService, FormValues } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { Observable, from, throwError, of } from 'rxjs';
|
||||
import { TaskDetailsModel } from '../../task-list';
|
||||
import { ProcessFilterParamRepresentationModel } from '../models/filter-process.model';
|
||||
import { ProcessDefinitionRepresentation } from '../models/process-definition.model';
|
||||
@@ -58,6 +58,13 @@ export class ProcessService {
|
||||
);
|
||||
}
|
||||
|
||||
getProcesses(requestNode: ProcessFilterParamRepresentationModel, processDefinitionKey?: string): Observable<ProcessListModel> {
|
||||
return this.getProcessInstances(requestNode, processDefinitionKey || null)
|
||||
.pipe(catchError(() => {
|
||||
return of(new ProcessListModel({}));
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the Process Audit information as a PDF.
|
||||
* @param processId ID of the target process
|
||||
@@ -102,9 +109,9 @@ export class ProcessService {
|
||||
*/
|
||||
getProcessTasks(processInstanceId: string, state?: string): Observable<TaskDetailsModel[]> {
|
||||
let taskOpts = state ? {
|
||||
processInstanceId: processInstanceId,
|
||||
state: state
|
||||
} : {
|
||||
processInstanceId: processInstanceId,
|
||||
state: state
|
||||
} : {
|
||||
processInstanceId: processInstanceId
|
||||
};
|
||||
return from(this.alfrescoApiService.getInstance().activiti.taskApi.listTasks(taskOpts))
|
||||
@@ -125,19 +132,19 @@ export class ProcessService {
|
||||
*/
|
||||
getProcessDefinitions(appId?: number): Observable<ProcessDefinitionRepresentation[]> {
|
||||
let opts = appId ? {
|
||||
latest: true,
|
||||
appDefinitionId: appId
|
||||
} : {
|
||||
latest: true,
|
||||
appDefinitionId: appId
|
||||
} : {
|
||||
latest: true
|
||||
};
|
||||
return from(
|
||||
this.alfrescoApiService.getInstance().activiti.processApi.getProcessDefinitions(opts)
|
||||
)
|
||||
.pipe(
|
||||
map(this.extractData),
|
||||
map(processDefs => processDefs.map((pd) => new ProcessDefinitionRepresentation(pd))),
|
||||
catchError(err => this.handleProcessError(err))
|
||||
);
|
||||
.pipe(
|
||||
map(this.extractData),
|
||||
map(processDefs => processDefs.map((pd) => new ProcessDefinitionRepresentation(pd))),
|
||||
catchError(err => this.handleProcessError(err))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,10 +173,10 @@ export class ProcessService {
|
||||
return from(
|
||||
this.alfrescoApiService.getInstance().activiti.processApi.startNewProcessInstance(startRequest)
|
||||
)
|
||||
.pipe(
|
||||
map((pd) => new ProcessInstance(pd)),
|
||||
catchError(err => this.handleProcessError(err))
|
||||
);
|
||||
.pipe(
|
||||
map((pd) => new ProcessInstance(pd)),
|
||||
catchError(err => this.handleProcessError(err))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,9 +188,9 @@ export class ProcessService {
|
||||
return from<void>(
|
||||
this.alfrescoApiService.getInstance().activiti.processApi.deleteProcessInstance(processInstanceId)
|
||||
)
|
||||
.pipe(
|
||||
catchError(err => this.handleProcessError(err))
|
||||
);
|
||||
.pipe(
|
||||
catchError(err => this.handleProcessError(err))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,10 +202,10 @@ export class ProcessService {
|
||||
return from(
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.getProcessInstanceVariables(processInstanceId)
|
||||
)
|
||||
.pipe(
|
||||
map((processVars: any[]) => processVars.map((pd) => new ProcessInstanceVariable(pd))),
|
||||
catchError(err => this.handleProcessError(err))
|
||||
);
|
||||
.pipe(
|
||||
map((processVars: any[]) => processVars.map((pd) => new ProcessInstanceVariable(pd))),
|
||||
catchError(err => this.handleProcessError(err))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,9 +218,9 @@ export class ProcessService {
|
||||
return from<ProcessInstanceVariable[]>(
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.createOrUpdateProcessInstanceVariables(processInstanceId, variables)
|
||||
)
|
||||
.pipe(
|
||||
catchError(err => this.handleProcessError(err))
|
||||
);
|
||||
.pipe(
|
||||
catchError(err => this.handleProcessError(err))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,9 +233,9 @@ export class ProcessService {
|
||||
return from<void>(
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.deleteProcessInstanceVariable(processInstanceId, variableName)
|
||||
)
|
||||
.pipe(
|
||||
catchError(err => this.handleProcessError(err))
|
||||
);
|
||||
.pipe(
|
||||
catchError(err => this.handleProcessError(err))
|
||||
);
|
||||
}
|
||||
|
||||
private extractData(res: any) {
|
||||
|
Reference in New Issue
Block a user