[ADF-3065] TaskList component - Deprecate the processDefinitionKey (#3369)

* Deprecate the processDefinitionKey property.
remove unused tasklist code. It was needed with the old pagination component

* Remove nosense test

* Use adf version
This commit is contained in:
Maurizio Vitale
2018-05-23 11:53:56 +01:00
committed by Eugenio Romano
parent b9e888ac11
commit 86f4c23afa
6 changed files with 6 additions and 43 deletions

View File

@@ -50,8 +50,7 @@ import {
TaskDetailsComponent, TaskDetailsComponent,
TaskDetailsEvent, TaskDetailsEvent,
TaskFiltersComponent, TaskFiltersComponent,
TaskListComponent, TaskListComponent
TaskListService
} from '@alfresco/adf-process-services'; } from '@alfresco/adf-process-services';
import { LogService } from '@alfresco/adf-core'; import { LogService } from '@alfresco/adf-core';
import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core'; import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
@@ -157,7 +156,6 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
constructor(private elementRef: ElementRef, constructor(private elementRef: ElementRef,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
private taskListService: TaskListService,
private apiService: AlfrescoApiService, private apiService: AlfrescoApiService,
private logService: LogService, private logService: LogService,
private appConfig: AppConfigService, private appConfig: AppConfigService,
@@ -234,7 +232,6 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
ngOnDestroy() { ngOnDestroy() {
this.sub.unsubscribe(); this.sub.unsubscribe();
this.taskListService.tasksList$.subscribe();
} }
onTaskFilterClick(filter: FilterRepresentationModel): void { onTaskFilterClick(filter: FilterRepresentationModel): void {

View File

@@ -26,7 +26,7 @@ Renders a list containing all the tasks matched by the parameters specified.
| ---- | ---- | ------------- | ----------- | | ---- | ---- | ------------- | ----------- |
| appId | `number` | | The id of the app. | | appId | `number` | | The id of the app. |
| processInstanceId | `string` | | The Instance Id of the process. | | processInstanceId | `string` | | The Instance Id of the process. |
| processDefinitionKey | `string` | | The Definition Key of the process. | | processDefinitionKey | `string` | | The Definition Key of the process. **Deprecated:** in 2.4.0 |
| state | `string` | | Current state of the process. Possible values are: `completed`, `active`. | | state | `string` | | Current state of the process. Possible values are: `completed`, `active`. |
| assignment | `string` | | The assignment of the process. Possible values are: "assignee" (the current user is the assignee), candidate (the current user is a task candidate", "group_x" (the task is assigned to a group where the current user is a member, no value(the current user is involved). | | assignment | `string` | | The assignment of the process. Possible values are: "assignee" (the current user is the assignee), candidate (the current user is a task candidate", "group_x" (the task is assigned to a group where the current user is a member, no value(the current user is involved). |
| sort | `string` | | Define the sort order of the processes. Possible values are : `created-desc`, `created-asc`, `due-desc`, `due-asc` | | sort | `string` | | Define the sort order of the processes. Possible values are : `created-desc`, `created-asc`, `due-desc`, `due-asc` |

View File

@@ -50,7 +50,9 @@ export class TaskListComponent implements OnChanges, AfterContentInit, Paginated
@Input() @Input()
processInstanceId: string; processInstanceId: string;
/** The Definition Key of the process. */ /** The Definition Key of the process.
* @deprecated 2.4.0
*/
@Input() @Input()
processDefinitionKey: string; processDefinitionKey: string;

View File

@@ -18,20 +18,14 @@
import { AlfrescoApiService, LogService } from '@alfresco/adf-core'; import { AlfrescoApiService, LogService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { FilterRepresentationModel } from '../models/filter.model'; import { FilterRepresentationModel } from '../models/filter.model';
import { TaskListModel } from '../models/task-list.model';
import 'rxjs/add/observable/throw'; import 'rxjs/add/observable/throw';
@Injectable() @Injectable()
export class TaskFilterService { export class TaskFilterService {
private tasksListSubject = new Subject<TaskListModel>();
public tasksList$: Observable<TaskListModel>;
constructor(private apiService: AlfrescoApiService, constructor(private apiService: AlfrescoApiService,
private logService: LogService) { private logService: LogService) {
this.tasksList$ = this.tasksListSubject.asObservable();
} }
/** /**
@@ -216,7 +210,6 @@ export class TaskFilterService {
private handleError(error: any) { private handleError(error: any) {
this.logService.error(error); this.logService.error(error);
this.tasksListSubject.error(error);
return Observable.throw(error || 'Server error'); return Observable.throw(error || 'Server error');
} }

View File

@@ -76,27 +76,6 @@ describe('Activiti TaskList Service', () => {
}); });
}); });
it('should return the task list filtered by processDefinitionKey', (done) => {
service.getTasks(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(res => {
expect(res).toBeDefined();
expect(res.size).toEqual(2);
expect(res.start).toEqual(0);
expect(res.data).toBeDefined();
expect(res.data.length).toEqual(2);
expect(res.data[0].name).toEqual('FakeNameTask');
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
expect(res.data[0].assignee.firstName).toEqual('firstName');
expect(res.data[0].assignee.lastName).toEqual('lastName');
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
'status': 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeTaskListDifferentProcessDefinitionKey)
});
});
it('should return the task list with all tasks filtered by state', (done) => { it('should return the task list with all tasks filtered by state', (done) => {
spyOn(service, 'getTasks').and.returnValue(Observable.of(fakeTaskList)); spyOn(service, 'getTasks').and.returnValue(Observable.of(fakeTaskList));
spyOn(service, 'getTotalTasks').and.returnValue(Observable.of(fakeTaskList)); spyOn(service, 'getTotalTasks').and.returnValue(Observable.of(fakeTaskList));

View File

@@ -18,7 +18,6 @@
import { AlfrescoApiService, LogService } from '@alfresco/adf-core'; import { AlfrescoApiService, LogService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { FilterRepresentationModel, TaskQueryRequestRepresentationModel } from '../models/filter.model'; import { FilterRepresentationModel, TaskQueryRequestRepresentationModel } from '../models/filter.model';
import { Form } from '../models/form.model'; import { Form } from '../models/form.model';
import { TaskDetailsModel } from '../models/task-details.model'; import { TaskDetailsModel } from '../models/task-details.model';
@@ -31,13 +30,9 @@ import 'rxjs/add/observable/from';
@Injectable() @Injectable()
export class TaskListService { export class TaskListService {
private tasksListSubject = new Subject<TaskListModel>();
public tasksList$: Observable<TaskListModel>;
constructor(private apiService: AlfrescoApiService, constructor(private apiService: AlfrescoApiService,
private logService: LogService) { private logService: LogService) {
this.tasksList$ = this.tasksListSubject.asObservable();
} }
/** /**
@@ -88,8 +83,7 @@ export class TaskListService {
*/ */
getTasks(requestNode: TaskQueryRequestRepresentationModel): Observable<TaskListModel> { getTasks(requestNode: TaskQueryRequestRepresentationModel): Observable<TaskListModel> {
return Observable.fromPromise(this.callApiTasksFiltered(requestNode)) return Observable.fromPromise(this.callApiTasksFiltered(requestNode))
.map((res: any) => { .map((res: TaskListModel) => {
this.tasksListSubject.next(res);
return res; return res;
}).catch(err => this.handleError(err)); }).catch(err => this.handleError(err));
} }
@@ -136,7 +130,6 @@ export class TaskListService {
const tasks = Object.assign({}, activeTasks); const tasks = Object.assign({}, activeTasks);
tasks.total += completedTasks.total; tasks.total += completedTasks.total;
tasks.data = tasks.data.concat(completedTasks.data); tasks.data = tasks.data.concat(completedTasks.data);
this.tasksListSubject.next(tasks);
return tasks; return tasks;
} }
); );
@@ -374,7 +367,6 @@ export class TaskListService {
private handleError(error: any) { private handleError(error: any) {
this.logService.error(error); this.logService.error(error);
this.tasksListSubject.error(error);
return Observable.throw(error || 'Server error'); return Observable.throw(error || 'Server error');
} }