mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
tasklist modify step 1
This commit is contained in:
@@ -13,6 +13,12 @@ npm install --save ng2-activiti-form
|
|||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
|
Add the following dependency to your index.html:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="node_modules/alfresco-js-api/dist/alfresco-js-api.js"></script>
|
||||||
|
```
|
||||||
|
|
||||||
You must separately install the following libraries for your application:
|
You must separately install the following libraries for your application:
|
||||||
|
|
||||||
- [ng2-translate](https://github.com/ocombe/ng2-translate)
|
- [ng2-translate](https://github.com/ocombe/ng2-translate)
|
||||||
|
@@ -17,6 +17,7 @@ module.exports = function (config) {
|
|||||||
{pattern: 'node_modules/@angular/**/*.map', included: false, watched: false},
|
{pattern: 'node_modules/@angular/**/*.map', included: false, watched: false},
|
||||||
{pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false},
|
{pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false},
|
||||||
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, served: true, watched: false},
|
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, served: true, watched: false},
|
||||||
|
{pattern: 'node_modules/alfresco-js-api/dist/alfresco-js-api.js', included: true, watched: false},
|
||||||
|
|
||||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||||
|
|
||||||
|
@@ -21,6 +21,7 @@ module.exports = function (config) {
|
|||||||
{pattern: 'node_modules/ng2-alfresco-datatable/dist/**/*.html', included: false, served: true, watched: false},
|
{pattern: 'node_modules/ng2-alfresco-datatable/dist/**/*.html', included: false, served: true, watched: false},
|
||||||
{pattern: 'node_modules/ng2-alfresco-datatable/dist/**/*.css', included: false, served: true, watched: false},
|
{pattern: 'node_modules/ng2-alfresco-datatable/dist/**/*.css', included: false, served: true, watched: false},
|
||||||
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, served: true, watched: false},
|
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, served: true, watched: false},
|
||||||
|
{pattern: 'node_modules/alfresco-js-api/dist/alfresco-js-api.js', included: true, watched: false},
|
||||||
|
|
||||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||||
|
|
||||||
|
@@ -13,6 +13,12 @@ npm install --save ng2-activiti-tasklist
|
|||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
|
Add the following dependency to your index.html:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="node_modules/alfresco-js-api/dist/alfresco-js-api.js"></script>
|
||||||
|
```
|
||||||
|
|
||||||
You must separately install the following libraries for your application:
|
You must separately install the following libraries for your application:
|
||||||
|
|
||||||
- [ng2-translate](https://github.com/ocombe/ng2-translate)
|
- [ng2-translate](https://github.com/ocombe/ng2-translate)
|
||||||
|
@@ -3,12 +3,6 @@
|
|||||||
"description": "Alfresco Angular2 DataTable Component - Demo",
|
"description": "Alfresco Angular2 DataTable Component - Demo",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"author": "Alfresco Software, Ltd.",
|
"author": "Alfresco Software, Ltd.",
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Maurizio Vitale",
|
|
||||||
"email": "maurizio.vitale84@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rimraf dist node_modules typings",
|
"clean": "rimraf dist node_modules typings",
|
||||||
@@ -70,6 +64,16 @@
|
|||||||
"!/**/typings/**/*",
|
"!/**/typings/**/*",
|
||||||
"!*.js"
|
"!*.js"
|
||||||
],
|
],
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Maurizio Vitale",
|
||||||
|
"email": "maurizio.vitale84@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Eugenio Romano",
|
||||||
|
"email": "eugenio.romano@alfresco.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
"path": "assets/license_header.txt",
|
"path": "assets/license_header.txt",
|
||||||
"blocking": true,
|
"blocking": true,
|
||||||
"logInfo": false,
|
"logInfo": false,
|
||||||
|
@@ -38,6 +38,10 @@
|
|||||||
{
|
{
|
||||||
"name": "Maurizio Vitale",
|
"name": "Maurizio Vitale",
|
||||||
"email": "maurizio.vitale84@gmail.com"
|
"email": "maurizio.vitale84@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Eugenio Romano",
|
||||||
|
"email": "eugenio.romano@alfresco.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@@ -48,7 +48,7 @@ describe('ActivitiFilters', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
let activitiService = new ActivitiTaskListService(null, null, null);
|
let activitiService = new ActivitiTaskListService(null);
|
||||||
filterList = new ActivitiFilters(null, null, activitiService);
|
filterList = new ActivitiFilters(null, null, activitiService);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -62,6 +62,7 @@ export class ActivitiFilters implements OnInit {
|
|||||||
* Constructor
|
* Constructor
|
||||||
* @param auth
|
* @param auth
|
||||||
* @param translate
|
* @param translate
|
||||||
|
* @param activiti
|
||||||
*/
|
*/
|
||||||
constructor(private auth: AlfrescoAuthenticationService,
|
constructor(private auth: AlfrescoAuthenticationService,
|
||||||
private translate: AlfrescoTranslationService,
|
private translate: AlfrescoTranslationService,
|
||||||
|
@@ -64,7 +64,7 @@ describe('ActivitiTaskList', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
let activitiSerevice = new ActivitiTaskListService(null, null, null);
|
let activitiSerevice = new ActivitiTaskListService(null);
|
||||||
taskList = new ActivitiTaskList(null, null, activitiSerevice);
|
taskList = new ActivitiTaskList(null, null, activitiSerevice);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -66,6 +66,7 @@ export class ActivitiTaskList implements OnInit {
|
|||||||
* Constructor
|
* Constructor
|
||||||
* @param auth
|
* @param auth
|
||||||
* @param translate
|
* @param translate
|
||||||
|
* @param translate
|
||||||
*/
|
*/
|
||||||
constructor(private auth: AlfrescoAuthenticationService,
|
constructor(private auth: AlfrescoAuthenticationService,
|
||||||
private translate: AlfrescoTranslationService,
|
private translate: AlfrescoTranslationService,
|
||||||
|
@@ -15,12 +15,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, describe, inject, beforeEach, beforeEachProviders } from '@angular/core/testing';
|
import {it, describe, inject, beforeEach, beforeEachProviders} from '@angular/core/testing';
|
||||||
import { ActivitiTaskListService } from './activiti-tasklist.service';
|
import {ActivitiTaskListService} from './activiti-tasklist.service';
|
||||||
import { AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
import {AlfrescoSettingsService, AlfrescoAuthenticationService} from 'ng2-alfresco-core';
|
||||||
import { HTTP_PROVIDERS } from '@angular/http';
|
import {TaskDetailsModel} from '../models/task-details.model';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
import {Comment} from '../models/comment.model';
|
||||||
import { Comment } from '../models/comment.model';
|
|
||||||
|
|
||||||
declare let AlfrescoApi: any;
|
declare let AlfrescoApi: any;
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
@@ -44,10 +43,10 @@ describe('ActivitiTaskListService', () => {
|
|||||||
|
|
||||||
let fakeFilter = {
|
let fakeFilter = {
|
||||||
page: 2, filterId: 2, appDefinitionId: null,
|
page: 2, filterId: 2, appDefinitionId: null,
|
||||||
filter: {sort: 'created-desc', name: '', state: 'open', assignment: 'fake-assignee' }
|
filter: {sort: 'created-desc', name: '', state: 'open', assignment: 'fake-assignee'}
|
||||||
};
|
};
|
||||||
|
|
||||||
let fakeUser = { id: 1, email: 'fake-email@dom.com', firstName: 'firstName', lastName: 'lastName' };
|
let fakeUser = {id: 1, email: 'fake-email@dom.com', firstName: 'firstName', lastName: 'lastName'};
|
||||||
|
|
||||||
let fakeTaskList = {
|
let fakeTaskList = {
|
||||||
size: 1, total: 1, start: 0,
|
size: 1, total: 1, start: 0,
|
||||||
@@ -64,7 +63,7 @@ describe('ActivitiTaskListService', () => {
|
|||||||
error: 'wrong request'
|
error: 'wrong request'
|
||||||
};
|
};
|
||||||
|
|
||||||
let fakeTaskDetails = {id: '999', name: 'fake-task-name', formKey: '99', assignee: fakeUser };
|
let fakeTaskDetails = {id: '999', name: 'fake-task-name', formKey: '99', assignee: fakeUser};
|
||||||
|
|
||||||
let fakeTasksComment = {
|
let fakeTasksComment = {
|
||||||
size: 2, total: 2, start: 0,
|
size: 2, total: 2, start: 0,
|
||||||
@@ -96,16 +95,16 @@ describe('ActivitiTaskListService', () => {
|
|||||||
|
|
||||||
beforeEachProviders(() => {
|
beforeEachProviders(() => {
|
||||||
return [
|
return [
|
||||||
HTTP_PROVIDERS,
|
ActivitiTaskListService,
|
||||||
AlfrescoSettingsService,
|
AlfrescoSettingsService,
|
||||||
AlfrescoAuthenticationService,
|
AlfrescoAuthenticationService
|
||||||
ActivitiTaskListService
|
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach( inject([ActivitiTaskListService], (activitiService: ActivitiTaskListService) => {
|
|
||||||
|
beforeEach(inject([ActivitiTaskListService], (activitiTaskListService: ActivitiTaskListService) => {
|
||||||
jasmine.Ajax.install();
|
jasmine.Ajax.install();
|
||||||
service = activitiService;
|
service = activitiTaskListService;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -235,7 +234,11 @@ describe('ActivitiTaskListService', () => {
|
|||||||
|
|
||||||
it('should add a task ', (done) => {
|
it('should add a task ', (done) => {
|
||||||
let taskFake = new TaskDetailsModel({
|
let taskFake = new TaskDetailsModel({
|
||||||
id: '', name: 'FakeNameTask', description: null, category: null,
|
id: 123,
|
||||||
|
parentTaskId: 456,
|
||||||
|
name: 'FakeNameTask',
|
||||||
|
description: null,
|
||||||
|
category: null,
|
||||||
assignee: fakeUser,
|
assignee: fakeUser,
|
||||||
created: ''
|
created: ''
|
||||||
});
|
});
|
||||||
@@ -306,5 +309,4 @@ describe('ActivitiTaskListService', () => {
|
|||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -15,24 +15,19 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import { AlfrescoSettingsService } from 'ng2-alfresco-core';
|
import {AlfrescoAuthenticationService} from 'ng2-alfresco-core';
|
||||||
import { Http, Headers, RequestOptions, Response } from '@angular/http';
|
import {Observable} from 'rxjs/Rx';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import {FilterModel} from '../models/filter.model';
|
||||||
import { AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
import {FilterParamsModel} from '../models/filter.model';
|
||||||
import { FilterModel } from '../models/filter.model';
|
import {Comment} from '../models/comment.model';
|
||||||
import { FilterParamsModel } from '../models/filter.model';
|
import {User} from '../models/user.model';
|
||||||
import { Comment } from '../models/comment.model';
|
import {TaskDetailsModel} from '../models/task-details.model';
|
||||||
import { User } from '../models/user.model';
|
|
||||||
|
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ActivitiTaskListService {
|
export class ActivitiTaskListService {
|
||||||
|
|
||||||
constructor(private http: Http,
|
constructor(public authService: AlfrescoAuthenticationService) {
|
||||||
public alfrescoSettingsService: AlfrescoSettingsService,
|
|
||||||
private authService: AlfrescoAuthenticationService) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -41,12 +36,9 @@ export class ActivitiTaskListService {
|
|||||||
* @returns {Observable<any>}
|
* @returns {Observable<any>}
|
||||||
*/
|
*/
|
||||||
getDeployedApplications(name: string): Observable<any> {
|
getDeployedApplications(name: string): Observable<any> {
|
||||||
let url = this.alfrescoSettingsService.getBPMApiBaseUrl() + `/api/enterprise/runtime-app-definitions`;
|
return Observable.fromPromise(this.authService.getAlfrescoApi().activiti.appsApi.getAppDefinitions())
|
||||||
return this.http
|
.map((response: any) => response.data.find(p => p.name === name))
|
||||||
.get(url, this.getRequestOptions())
|
.do(data => console.log('Application: ' + JSON.stringify(data)));
|
||||||
.map((response: Response) => response.json().data.find(p => p.name === name))
|
|
||||||
.do(data => console.log('Application: ' + JSON.stringify(data)))
|
|
||||||
.catch(this.handleError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +47,6 @@ export class ActivitiTaskListService {
|
|||||||
*/
|
*/
|
||||||
getTaskListFilters(appId?: string): Observable<any> {
|
getTaskListFilters(appId?: string): Observable<any> {
|
||||||
return Observable.fromPromise(this.callApiTaskFilters(appId))
|
return Observable.fromPromise(this.callApiTaskFilters(appId))
|
||||||
.map(res => res.json())
|
|
||||||
.map((response: any) => {
|
.map((response: any) => {
|
||||||
let filters: FilterModel[] = [];
|
let filters: FilterModel[] = [];
|
||||||
response.data.forEach((filter) => {
|
response.data.forEach((filter) => {
|
||||||
@@ -64,8 +55,7 @@ export class ActivitiTaskListService {
|
|||||||
filters.push(filterModel);
|
filters.push(filterModel);
|
||||||
});
|
});
|
||||||
return filters;
|
return filters;
|
||||||
})
|
});
|
||||||
.catch(this.handleError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,12 +64,10 @@ export class ActivitiTaskListService {
|
|||||||
* @returns {any}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
getTasks(filter: FilterModel): Observable<any> {
|
getTasks(filter: FilterModel): Observable<any> {
|
||||||
|
|
||||||
return Observable.fromPromise(this.callApiTasksFiltered(filter.filter))
|
return Observable.fromPromise(this.callApiTasksFiltered(filter.filter))
|
||||||
.map((res: Response) => {
|
.map((res: any) => {
|
||||||
return res.json();
|
return res;
|
||||||
})
|
});
|
||||||
.catch(this.handleError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,11 +77,10 @@ export class ActivitiTaskListService {
|
|||||||
*/
|
*/
|
||||||
getTaskDetails(id: string): Observable<TaskDetailsModel> {
|
getTaskDetails(id: string): Observable<TaskDetailsModel> {
|
||||||
return Observable.fromPromise(this.callApiTaskDetails(id))
|
return Observable.fromPromise(this.callApiTaskDetails(id))
|
||||||
.map(res => res.json())
|
.map(res => res)
|
||||||
.map((details: any) => {
|
.map((details: any) => {
|
||||||
return new TaskDetailsModel(details);
|
return new TaskDetailsModel(details);
|
||||||
})
|
});
|
||||||
.catch(this.handleError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,7 +90,7 @@ export class ActivitiTaskListService {
|
|||||||
*/
|
*/
|
||||||
getTaskComments(id: string): Observable<Comment[]> {
|
getTaskComments(id: string): Observable<Comment[]> {
|
||||||
return Observable.fromPromise(this.callApiTaskComments(id))
|
return Observable.fromPromise(this.callApiTaskComments(id))
|
||||||
.map(res => res.json())
|
.map(res => res)
|
||||||
.map((response: any) => {
|
.map((response: any) => {
|
||||||
let comments: Comment[] = [];
|
let comments: Comment[] = [];
|
||||||
response.data.forEach((comment) => {
|
response.data.forEach((comment) => {
|
||||||
@@ -112,8 +99,7 @@ export class ActivitiTaskListService {
|
|||||||
comments.push(new Comment(comment.id, comment.message, comment.created, user));
|
comments.push(new Comment(comment.id, comment.message, comment.created, user));
|
||||||
});
|
});
|
||||||
return comments;
|
return comments;
|
||||||
})
|
});
|
||||||
.catch(this.handleError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,15 +109,14 @@ export class ActivitiTaskListService {
|
|||||||
*/
|
*/
|
||||||
getTaskChecklist(id: string): Observable<TaskDetailsModel[]> {
|
getTaskChecklist(id: string): Observable<TaskDetailsModel[]> {
|
||||||
return Observable.fromPromise(this.callApiTaskChecklist(id))
|
return Observable.fromPromise(this.callApiTaskChecklist(id))
|
||||||
.map(res => res.json())
|
.map(res => res)
|
||||||
.map((response: any) => {
|
.map((response: any) => {
|
||||||
let checklists: TaskDetailsModel[] = [];
|
let checklists: TaskDetailsModel[] = [];
|
||||||
response.data.forEach((checklist) => {
|
response.data.forEach((checklist) => {
|
||||||
checklists.push(new TaskDetailsModel(checklist));
|
checklists.push(new TaskDetailsModel(checklist));
|
||||||
});
|
});
|
||||||
return checklists;
|
return checklists;
|
||||||
})
|
});
|
||||||
.catch(this.handleError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,11 +126,10 @@ export class ActivitiTaskListService {
|
|||||||
*/
|
*/
|
||||||
addTask(task: TaskDetailsModel): Observable<TaskDetailsModel> {
|
addTask(task: TaskDetailsModel): Observable<TaskDetailsModel> {
|
||||||
return Observable.fromPromise(this.callApiAddTask(task))
|
return Observable.fromPromise(this.callApiAddTask(task))
|
||||||
.map(res => res.json())
|
.map(res => res)
|
||||||
.map((response: TaskDetailsModel) => {
|
.map((response: TaskDetailsModel) => {
|
||||||
return new TaskDetailsModel(response);
|
return new TaskDetailsModel(response);
|
||||||
})
|
});
|
||||||
.catch(this.handleError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -156,11 +140,10 @@ export class ActivitiTaskListService {
|
|||||||
*/
|
*/
|
||||||
addTaskComment(id: string, message: string): Observable<Comment> {
|
addTaskComment(id: string, message: string): Observable<Comment> {
|
||||||
return Observable.fromPromise(this.callApiAddTaskComment(id, message))
|
return Observable.fromPromise(this.callApiAddTaskComment(id, message))
|
||||||
.map(res => res.json())
|
.map(res => res)
|
||||||
.map((response: Comment) => {
|
.map((response: Comment) => {
|
||||||
return new Comment(response.id, response.message, response.created, response.createdBy);
|
return new Comment(response.id, response.message, response.created, response.createdBy);
|
||||||
})
|
});
|
||||||
.catch(this.handleError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -168,97 +151,45 @@ export class ActivitiTaskListService {
|
|||||||
* @param id - taskId
|
* @param id - taskId
|
||||||
* @returns {TaskDetailsModel}
|
* @returns {TaskDetailsModel}
|
||||||
*/
|
*/
|
||||||
completeTask(id: string): Observable<TaskDetailsModel> {
|
completeTask(id: string) {
|
||||||
return Observable.fromPromise(this.callApiCompleteTask(id))
|
return Observable.fromPromise(this.callApiCompleteTask(id))
|
||||||
.map(res => res.json())
|
.map(res => res);
|
||||||
.catch(this.handleError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private callApiTasksFiltered(filter: FilterParamsModel) {
|
private callApiTasksFiltered(filter: FilterParamsModel) {
|
||||||
let data = JSON.stringify(filter);
|
return this.authService.getAlfrescoApi().activiti.taskApi.listTasks(filter);
|
||||||
let url = this.alfrescoSettingsService.getBPMApiBaseUrl() + `/api/enterprise/tasks/query`;
|
|
||||||
|
|
||||||
return this.http
|
|
||||||
.post(url, data, this.getRequestOptions()).toPromise();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private callApiTaskFilters(appId?: string) {
|
private callApiTaskFilters(appId?: string) {
|
||||||
let url = this.alfrescoSettingsService.getBPMApiBaseUrl();
|
|
||||||
if (appId) {
|
if (appId) {
|
||||||
url = url + `/api/enterprise/filters/tasks?appId=${appId}`;
|
return this.authService.getAlfrescoApi().activiti.taskApi.filterTasks({appDefinitionId: appId});
|
||||||
} else {
|
} else {
|
||||||
url = url + `/api/enterprise/filters/tasks`;
|
return this.authService.getAlfrescoApi().activiti.taskApi.filterTasks({});
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.http
|
|
||||||
.get(url, this.getRequestOptions()).toPromise();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private callApiTaskDetails(id: string) {
|
private callApiTaskDetails(id: string) {
|
||||||
let url = this.alfrescoSettingsService.getBPMApiBaseUrl() + `/api/enterprise/tasks/${id}`;
|
return this.authService.getAlfrescoApi().activiti.taskApi.getTask(id);
|
||||||
|
|
||||||
return this.http
|
|
||||||
.get(url, this.getRequestOptions()).toPromise();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private callApiTaskComments(id: string) {
|
private callApiTaskComments(id: string) {
|
||||||
let url = this.alfrescoSettingsService.getBPMApiBaseUrl() + `/api/enterprise/tasks/${id}/comments`;
|
return this.authService.getAlfrescoApi().activiti.taskApi.getTaskComments(id);
|
||||||
|
|
||||||
return this.http
|
|
||||||
.get(url, this.getRequestOptions()).toPromise();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private callApiAddTaskComment(id: string, message: string) {
|
private callApiAddTaskComment(id: string, message: string) {
|
||||||
let url = this.alfrescoSettingsService.getBPMApiBaseUrl() + `/api/enterprise/tasks/${id}/comments`;
|
return this.authService.getAlfrescoApi().activiti.taskApi.addTaskComment({message: message}, id);
|
||||||
let body = JSON.stringify({message: message});
|
|
||||||
|
|
||||||
return this.http
|
|
||||||
.post(url, body, this.getRequestOptions()).toPromise();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private callApiAddTask(task: TaskDetailsModel) {
|
private callApiAddTask(task: TaskDetailsModel) {
|
||||||
let url = this.alfrescoSettingsService.getBPMApiBaseUrl() + `/api/enterprise/tasks/${task.parentTaskId}/checklist`;
|
return this.authService.getAlfrescoApi().activiti.taskApi.addSubtask(task.parentTaskId, task);
|
||||||
let body = JSON.stringify(task);
|
|
||||||
|
|
||||||
return this.http
|
|
||||||
.post(url, body, this.getRequestOptions()).toPromise();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private callApiTaskChecklist(id: string) {
|
private callApiTaskChecklist(id: string) {
|
||||||
let url = this.alfrescoSettingsService.getBPMApiBaseUrl() + `/api/enterprise/tasks/${id}/checklist`;
|
return this.authService.getAlfrescoApi().activiti.taskApi.getChecklist(id);
|
||||||
|
|
||||||
return this.http
|
|
||||||
.get(url, this.getRequestOptions()).toPromise();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private callApiCompleteTask(id: string) {
|
private callApiCompleteTask(id: string) {
|
||||||
let url = this.alfrescoSettingsService.getBPMApiBaseUrl() + `/api/enterprise/tasks/${id}/action/complete`;
|
return this.authService.getAlfrescoApi().activiti.taskApi.completeTask(id);
|
||||||
|
|
||||||
return this.http
|
|
||||||
.put(url, this.getRequestOptions()).toPromise();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The method write the error in the console browser
|
|
||||||
* @param error
|
|
||||||
* @returns {ErrorObservable}
|
|
||||||
*/
|
|
||||||
public handleError(error: Response): Observable<any> {
|
|
||||||
console.error('Error when logging in', error);
|
|
||||||
return Observable.throw(error || 'Server error');
|
|
||||||
}
|
|
||||||
|
|
||||||
private getHeaders(): Headers {
|
|
||||||
return new Headers({
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Authorization': this.authService.getTicket('BPM')
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private getRequestOptions(): RequestOptions {
|
|
||||||
let headers = this.getHeaders();
|
|
||||||
return new RequestOptions({headers: headers});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ export class AlfrescoSettingsService {
|
|||||||
|
|
||||||
private _bpmContextPath = AlfrescoSettingsService.DEFAULT_BPM_CONTEXT_PATH;
|
private _bpmContextPath = AlfrescoSettingsService.DEFAULT_BPM_CONTEXT_PATH;
|
||||||
|
|
||||||
private providers: string = 'ECM'; // ECM, BPM , ALL
|
private providers: string = 'ALL'; // ECM, BPM , ALL
|
||||||
|
|
||||||
public get ecmHost(): string {
|
public get ecmHost(): string {
|
||||||
return this._ecmHost;
|
return this._ecmHost;
|
||||||
|
@@ -16,11 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, describe, inject, beforeEach, beforeEachProviders } from '@angular/core/testing';
|
import { it, describe, inject, beforeEach, beforeEachProviders } from '@angular/core/testing';
|
||||||
|
import { EventEmitter } from '@angular/core';
|
||||||
import { UploadService } from './upload.service';
|
import { UploadService } from './upload.service';
|
||||||
import { AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
import { AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
||||||
import { AlfrescoSettingsServiceMock } from '../assets/AlfrescoSettingsService.service.mock';
|
import { AlfrescoSettingsServiceMock } from '../assets/AlfrescoSettingsService.service.mock';
|
||||||
import { HTTP_PROVIDERS } from '@angular/http';
|
|
||||||
import { EventEmitter } from '@angular/core';
|
|
||||||
|
|
||||||
declare let AlfrescoApi: any;
|
declare let AlfrescoApi: any;
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
@@ -40,9 +39,8 @@ describe('AlfrescoUploadService', () => {
|
|||||||
|
|
||||||
beforeEachProviders(() => {
|
beforeEachProviders(() => {
|
||||||
return [
|
return [
|
||||||
HTTP_PROVIDERS,
|
|
||||||
{ provide: AlfrescoSettingsService, useClass: AlfrescoSettingsServiceMock },
|
{ provide: AlfrescoSettingsService, useClass: AlfrescoSettingsServiceMock },
|
||||||
{ provide: AlfrescoAuthenticationService, useClass: AlfrescoAuthenticationService },
|
AlfrescoAuthenticationService,
|
||||||
UploadService
|
UploadService
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
@@ -56,7 +56,7 @@ The following component needs to be added to your systemjs.config:
|
|||||||
|
|
||||||
- ng2-translate
|
- ng2-translate
|
||||||
- ng2-alfresco-core
|
- ng2-alfresco-core
|
||||||
- ng2-alfresco-datatable
|
- ng2-alfresco-dataœtable
|
||||||
|
|
||||||
Please refer to the following example to have an idea of how your systemjs.config should look like :
|
Please refer to the following example to have an idea of how your systemjs.config should look like :
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user