[DW-44] - Task Service - Add a new method to get the application details by Id (#1843)

ADF-555 New service that returns application details for a given appId
This commit is contained in:
Infad Kachancheri
2017-05-03 13:30:51 +05:30
committed by Eugenio Romano
parent 25cffb1f19
commit f89a0eafd9
2 changed files with 31 additions and 1 deletions

View File

@@ -506,6 +506,24 @@ describe('Activiti TaskList Service', () => {
}); });
}); });
it('should get the deployed app details by id ', (done) => {
service.getApplicationDetailsById(1).subscribe(
(app: any) => {
expect(app).toBeDefined();
expect(app.name).toEqual('Sales-Fakes-App');
expect(app.description).toEqual('desc-fake1');
expect(app.deploymentId).toEqual('111');
done();
}
);
jasmine.Ajax.requests.mostRecent().respondWith({
'status': 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeApps)
});
});
it('should create a new standalone task ', (done) => { it('should create a new standalone task ', (done) => {
let taskFake = new TaskDetailsModel({ let taskFake = new TaskDetailsModel({
name: 'FakeNameTask', name: 'FakeNameTask',

View File

@@ -42,13 +42,25 @@ export class ActivitiTaskListService {
return Observable.fromPromise(this.apiService.getInstance().activiti.appsApi.getAppDefinitions()) return Observable.fromPromise(this.apiService.getInstance().activiti.appsApi.getAppDefinitions())
.map((response: any) => { .map((response: any) => {
if (name) { if (name) {
return response.data.find(p => p.name === name); return response.data.find(app => app.name === name);
} }
return response.data; return response.data;
}) })
.catch(err => this.handleError(err)); .catch(err => this.handleError(err));
} }
/**
* Retrieve Deployed App details by appId
* @returns {Observable<any>}
*/
getApplicationDetailsById(appId: number): Observable<any> {
return Observable.fromPromise(this.apiService.getInstance().activiti.appsApi.getAppDefinitions())
.map((response: any) => {
return response.data.find(app => app.id === appId);
})
.catch(err => this.handleError(err));
}
/** /**
* Retrieve all the Tasks filters * Retrieve all the Tasks filters
* @returns {Observable<any>} * @returns {Observable<any>}