mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-4057] Edit getProcessInstanceByName method to search the process instance directly by its name (#6303)
* Add size value to getProcessInstanceByName * edit getProcessInstanceByName method to search the process instance directly by its name * add more options for filtering the list
This commit is contained in:
@@ -92,15 +92,11 @@ export class ProcessUtil {
|
||||
}
|
||||
}
|
||||
|
||||
async getProcessInstanceByName(processInstanceName: string): Promise<any> {
|
||||
async getProcessInstanceByName(processInstanceName: string, processInstanceStatus?: string, maxNumberOfResults?: number): Promise<any> {
|
||||
try {
|
||||
const processInstanceList = await this.api.apiService.activiti.processApi.getProcessInstances({state: 'all'});
|
||||
const chosenProcessInstance = processInstanceList.data.find( (processInstanace) => {
|
||||
return processInstanace.name === processInstanceName;
|
||||
});
|
||||
return chosenProcessInstance;
|
||||
return await this.api.apiService.activiti.processApi.filterProcessInstances({filter: {name: processInstanceName, state: processInstanceStatus}, size: maxNumberOfResults});
|
||||
} catch (error) {
|
||||
Logger.error('Get Process Instance by Name - Service error, Response: ', JSON.parse(JSON.stringify(error)));
|
||||
Logger.error('List process instances using a filter - Service error, Response: ', JSON.parse(JSON.stringify(error)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user