mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
ACS-5975 change getting tasks in tasklist component and service (#8987)
Co-authored-by: Grzegorz Jaskowski <grzegorz.jaskowski@hyland.com>
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, from, forkJoin, of } from 'rxjs';
|
||||
import { Observable, from, of } from 'rxjs';
|
||||
import { map, catchError, switchMap, flatMap, filter } from 'rxjs/operators';
|
||||
import { FilterRepresentationModel, TaskQueryRequestRepresentationModel } from '../models/filter.model';
|
||||
import { Form } from '../models/form.model';
|
||||
@@ -104,7 +104,7 @@ export class TaskListService {
|
||||
* Gets tasks matching a query and state value.
|
||||
*
|
||||
* @param requestNode Query to search for tasks
|
||||
* @param state Task state. Can be "open" or "completed".
|
||||
* @param state Task state. Can be "open" or "completed". State "all" applies to both "open" and "completed" tasks.
|
||||
* @returns List of tasks
|
||||
*/
|
||||
findTasksByState(requestNode: TaskQueryRequestRepresentationModel, state?: string): Observable<TaskListModel> {
|
||||
@@ -119,10 +119,10 @@ export class TaskListService {
|
||||
* Gets all tasks matching a query and state value.
|
||||
*
|
||||
* @param requestNode Query to search for tasks.
|
||||
* @param state Task state. Can be "open" or "completed".
|
||||
* @param state Task state. Can be "open" or "completed". State "all" applies to both "open" and "completed" tasks.
|
||||
* @returns List of tasks
|
||||
*/
|
||||
findAllTaskByState(requestNode: TaskQueryRequestRepresentationModel, state?: string): Observable<TaskListModel> {
|
||||
findAllTasksByState(requestNode: TaskQueryRequestRepresentationModel, state?: string): Observable<TaskListModel> {
|
||||
if (state) {
|
||||
requestNode.state = state;
|
||||
}
|
||||
@@ -135,25 +135,6 @@ export class TaskListService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all tasks matching the supplied query but ignoring the task state.
|
||||
*
|
||||
* @param requestNode Query to search for tasks
|
||||
* @returns List of tasks
|
||||
*/
|
||||
findAllTasksWithoutState(requestNode: TaskQueryRequestRepresentationModel): Observable<TaskListModel> {
|
||||
return forkJoin(
|
||||
this.findTasksByState(requestNode, 'open'),
|
||||
this.findAllTaskByState(requestNode, 'completed'),
|
||||
(activeTasks: TaskListModel, completedTasks: TaskListModel) => {
|
||||
const tasks = Object.assign({}, activeTasks);
|
||||
tasks.total += completedTasks.total;
|
||||
tasks.data = tasks.data.concat(completedTasks.data);
|
||||
return tasks;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets details for a task.
|
||||
*
|
||||
|
Reference in New Issue
Block a user