mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Provide a way to retrieve the task filter by Id or by name (#1815)
* Provide a way to retrieve the task filter by Id or by name * Update activiti-tasklist.service.ts * Update activiti-tasklist.service.spec.ts * Removed space
This commit is contained in:
committed by
Mario Romano
parent
88edb1697a
commit
87d889e8af
@@ -101,6 +101,46 @@ describe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should return the task filter by id', (done) => {
|
||||
service.getTaskFilterById('2').subscribe(
|
||||
(res: FilterRepresentationModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).toEqual('2');
|
||||
expect(res.name).toEqual('FakeMyTasks');
|
||||
expect(res.filter.sort).toEqual('created-desc');
|
||||
expect(res.filter.state).toEqual('open');
|
||||
expect(res.filter.assignment).toEqual('fake-assignee');
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify(fakeFilters)
|
||||
});
|
||||
});
|
||||
|
||||
it('should return the task filter by name', (done) => {
|
||||
service.getTaskFilterByName('FakeMyTasks').subscribe(
|
||||
(res: FilterRepresentationModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).toEqual('2');
|
||||
expect(res.name).toEqual('FakeMyTasks');
|
||||
expect(res.filter.sort).toEqual('created-desc');
|
||||
expect(res.filter.state).toEqual('open');
|
||||
expect(res.filter.assignment).toEqual('fake-assignee');
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify(fakeFilters)
|
||||
});
|
||||
});
|
||||
|
||||
it('should call the api withthe appId', (done) => {
|
||||
spyOn(service, 'callApiTaskFilters').and.returnValue((fakeAppPromise));
|
||||
|
||||
|
@@ -35,7 +35,7 @@ export class ActivitiTaskListService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive all the Deployed app
|
||||
* Retrieve all the Deployed app
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getDeployedApplications(name?: string): Observable<any> {
|
||||
@@ -50,7 +50,7 @@ export class ActivitiTaskListService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive all the Tasks filters
|
||||
* Retrieve all the Tasks filters
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getTaskListFilters(appId?: string): Observable<any> {
|
||||
@@ -65,6 +65,30 @@ export class ActivitiTaskListService {
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the Tasks filter by id
|
||||
* @param taskId - string - The id of the filter
|
||||
* @returns {Observable<FilterRepresentationModel>}
|
||||
*/
|
||||
getTaskFilterById(taskId: string, appId?: string): Observable<FilterRepresentationModel> {
|
||||
return Observable.fromPromise(this.callApiTaskFilters(appId))
|
||||
.map((response: any) => {
|
||||
return response.data.find(filter => filter.id === taskId);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the Tasks filter by name
|
||||
* @param taskName - string - The name of the filter
|
||||
* @returns {Observable<FilterRepresentationModel>}
|
||||
*/
|
||||
getTaskFilterByName(taskName: string, appId?: string): Observable<FilterRepresentationModel> {
|
||||
return Observable.fromPromise(this.callApiTaskFilters(appId))
|
||||
.map((response: any) => {
|
||||
return response.data.find(filter => filter.name === taskName);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the filters in the list where the task id belong
|
||||
* @param taskId - string
|
||||
@@ -108,7 +132,7 @@ export class ActivitiTaskListService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive all the tasks filtered by filterModel
|
||||
* Retrieve all the tasks filtered by filterModel
|
||||
* @param filter - TaskFilterRepresentationModel
|
||||
* @returns {any}
|
||||
*/
|
||||
@@ -124,7 +148,7 @@ export class ActivitiTaskListService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive all the task details
|
||||
* Retrieve all the task details
|
||||
* @param id - taskId
|
||||
* @returns {<TaskDetailsModel>}
|
||||
*/
|
||||
@@ -137,7 +161,7 @@ export class ActivitiTaskListService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive all the task's comments
|
||||
* Retrieve all the task's comments
|
||||
* @param id - taskId
|
||||
* @returns {<Comment[]>}
|
||||
*/
|
||||
@@ -155,7 +179,7 @@ export class ActivitiTaskListService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive all the task's checklist
|
||||
* Retrieve all the task's checklist
|
||||
* @param id - taskId
|
||||
* @returns {TaskDetailsModel}
|
||||
*/
|
||||
@@ -172,7 +196,7 @@ export class ActivitiTaskListService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive all the form shared with this user
|
||||
* Retrieve all the form shared with this user
|
||||
* @returns {TaskDetailsModel}
|
||||
*/
|
||||
getFormList(): Observable<Form []> {
|
||||
|
Reference in New Issue
Block a user