mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
Merge pull request #1322 from Alfresco/dev-valbano-1301
#1301 - Improve the process variables evaluation
This commit is contained in:
commit
c712cc2c82
@ -28,18 +28,17 @@ describe('ActivitiForm', () => {
|
|||||||
let componentHandler: any;
|
let componentHandler: any;
|
||||||
let formService: FormService;
|
let formService: FormService;
|
||||||
let formComponent: ActivitiForm;
|
let formComponent: ActivitiForm;
|
||||||
let visibilityService: WidgetVisibilityService;
|
let visibilityService: WidgetVisibilityService;
|
||||||
let nodeService: NodeService;
|
let nodeService: NodeService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||||
'upgradeAllRegistered'
|
'upgradeAllRegistered'
|
||||||
]);
|
]);
|
||||||
visibilityService = jasmine.createSpyObj('WidgetVisibilityService', [
|
|
||||||
'refreshVisibility', 'getTaskProcessVariable'
|
|
||||||
]);
|
|
||||||
window['componentHandler'] = componentHandler;
|
window['componentHandler'] = componentHandler;
|
||||||
|
|
||||||
|
visibilityService = new WidgetVisibilityService(null);
|
||||||
|
spyOn(visibilityService, 'refreshVisibility').and.stub();
|
||||||
formService = new FormService(null, null);
|
formService = new FormService(null, null);
|
||||||
nodeService = new NodeService(null, null);
|
nodeService = new NodeService(null, null);
|
||||||
formComponent = new ActivitiForm(formService, visibilityService, null, nodeService);
|
formComponent = new ActivitiForm(formService, visibilityService, null, nodeService);
|
||||||
@ -139,6 +138,7 @@ describe('ActivitiForm', () => {
|
|||||||
|
|
||||||
it('should get form by task id on load', () => {
|
it('should get form by task id on load', () => {
|
||||||
spyOn(formComponent, 'getFormByTaskId').and.stub();
|
spyOn(formComponent, 'getFormByTaskId').and.stub();
|
||||||
|
spyOn(visibilityService, 'getTaskProcessVariable').and.returnValue(Observable.of({}));
|
||||||
const taskId = '123';
|
const taskId = '123';
|
||||||
|
|
||||||
formComponent.taskId = taskId;
|
formComponent.taskId = taskId;
|
||||||
@ -218,7 +218,7 @@ describe('ActivitiForm', () => {
|
|||||||
spyOn(formComponent, 'getFormDefinitionByFormId').and.stub();
|
spyOn(formComponent, 'getFormDefinitionByFormId').and.stub();
|
||||||
spyOn(formComponent, 'getFormDefinitionByFormName').and.stub();
|
spyOn(formComponent, 'getFormDefinitionByFormName').and.stub();
|
||||||
|
|
||||||
formComponent.ngOnChanges({ 'tag': new SimpleChange(null, 'hello world')});
|
formComponent.ngOnChanges({ 'tag': new SimpleChange(null, 'hello world') });
|
||||||
|
|
||||||
expect(formComponent.getFormByTaskId).not.toHaveBeenCalled();
|
expect(formComponent.getFormByTaskId).not.toHaveBeenCalled();
|
||||||
expect(formComponent.getFormDefinitionByFormId).not.toHaveBeenCalled();
|
expect(formComponent.getFormDefinitionByFormId).not.toHaveBeenCalled();
|
||||||
@ -521,10 +521,10 @@ describe('ActivitiForm', () => {
|
|||||||
|
|
||||||
it('should complete form form and raise corresponding event', () => {
|
it('should complete form form and raise corresponding event', () => {
|
||||||
spyOn(formService, 'completeTaskForm').and.callFake(() => {
|
spyOn(formService, 'completeTaskForm').and.callFake(() => {
|
||||||
return Observable.create(observer => {
|
return Observable.create(observer => {
|
||||||
observer.next();
|
observer.next();
|
||||||
observer.complete();
|
observer.complete();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const outcome = 'complete';
|
const outcome = 'complete';
|
||||||
@ -572,17 +572,17 @@ describe('ActivitiForm', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
it('should update the visibility when the container raise the change event', (valueChanged) => {
|
it('should update the visibility when the container raise the change event', (valueChanged) => {
|
||||||
spyOn(formComponent, 'checkVisibility').and.callThrough();
|
spyOn(formComponent, 'checkVisibility').and.callThrough();
|
||||||
let widget = new ContainerWidget();
|
let widget = new ContainerWidget();
|
||||||
let fakeForm = new FormModel();
|
let fakeForm = new FormModel();
|
||||||
let fakeField = new FormFieldModel(fakeForm, {id: 'fakeField', value: 'fakeValue'});
|
let fakeField = new FormFieldModel(fakeForm, {id: 'fakeField', value: 'fakeValue'});
|
||||||
widget.formValueChanged.subscribe(field => { valueChanged(); });
|
widget.formValueChanged.subscribe(field => { valueChanged(); });
|
||||||
widget.fieldChanged(fakeField);
|
widget.fieldChanged(fakeField);
|
||||||
|
|
||||||
expect(formComponent.checkVisibility).toHaveBeenCalledWith(fakeField);
|
expect(formComponent.checkVisibility).toHaveBeenCalledWith(fakeField);
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
it('should prevent default outcome execution', () => {
|
it('should prevent default outcome execution', () => {
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
|
|||||||
loadForm() {
|
loadForm() {
|
||||||
if (this.taskId) {
|
if (this.taskId) {
|
||||||
this.getFormByTaskId(this.taskId);
|
this.getFormByTaskId(this.taskId);
|
||||||
this.visibilityService.getTaskProcessVariable(this.taskId);
|
this.visibilityService.getTaskProcessVariable(this.taskId).subscribe();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,7 +411,7 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
|
|||||||
*/
|
*/
|
||||||
getFormDefinitionOutcomes(form: FormModel): FormOutcomeModel[] {
|
getFormDefinitionOutcomes(form: FormModel): FormOutcomeModel[] {
|
||||||
return [
|
return [
|
||||||
new FormOutcomeModel(form, {id: '$custom', name: FormOutcomeModel.SAVE_ACTION, isSystem: true})
|
new FormOutcomeModel(form, { id: '$custom', name: FormOutcomeModel.SAVE_ACTION, isSystem: true })
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ describe('DisplayValueWidget', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
settingsService = new AlfrescoSettingsService();
|
settingsService = new AlfrescoSettingsService();
|
||||||
formService = new FormService(null, null);
|
formService = new FormService(null, null);
|
||||||
visibilityService = new WidgetVisibilityService(null, null, null);
|
visibilityService = new WidgetVisibilityService(null);
|
||||||
widget = new DisplayValueWidget(formService, visibilityService, settingsService);
|
widget = new DisplayValueWidget(formService, visibilityService, settingsService);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ describe('DropdownWidget', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
formService = new FormService(null, null);
|
formService = new FormService(null, null);
|
||||||
visibilityService = new WidgetVisibilityService(null, null, null);
|
visibilityService = new WidgetVisibilityService(null);
|
||||||
widget = new DropdownWidget(formService, visibilityService);
|
widget = new DropdownWidget(formService, visibilityService);
|
||||||
widget.field = new FormFieldModel(new FormModel());
|
widget.field = new FormFieldModel(new FormModel());
|
||||||
});
|
});
|
||||||
|
@ -28,7 +28,7 @@ describe('DynamicTableWidget', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
table = new DynamicTableModel(null);
|
table = new DynamicTableModel(null);
|
||||||
visibilityService = new WidgetVisibilityService(null, null, null);
|
visibilityService = new WidgetVisibilityService(null);
|
||||||
widget = new DynamicTableWidget(null, visibilityService);
|
widget = new DynamicTableWidget(null, visibilityService);
|
||||||
widget.content = table;
|
widget.content = table;
|
||||||
});
|
});
|
||||||
|
@ -36,7 +36,7 @@ describe('RadioButtonsWidget', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
formService = new FormService(null, null);
|
formService = new FormService(null, null);
|
||||||
visibilityService = new WidgetVisibilityService(null, null, null);
|
visibilityService = new WidgetVisibilityService(null);
|
||||||
widget = new RadioButtonsWidget(formService, visibilityService);
|
widget = new RadioButtonsWidget(formService, visibilityService);
|
||||||
widget.field = new FormFieldModel(new FormModel(), { restUrl: '<url>' });
|
widget.field = new FormFieldModel(new FormModel(), { restUrl: '<url>' });
|
||||||
});
|
});
|
||||||
|
@ -35,7 +35,7 @@ describe('TypeaheadWidget', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
formService = new FormService(null, null);
|
formService = new FormService(null, null);
|
||||||
visibilityService = new WidgetVisibilityService(null, null, null);
|
visibilityService = new WidgetVisibilityService(null);
|
||||||
widget = new TypeaheadWidget(formService, visibilityService);
|
widget = new TypeaheadWidget(formService, visibilityService);
|
||||||
widget.field = new FormFieldModel(new FormModel({ taskId: 'task-id' }));
|
widget.field = new FormFieldModel(new FormModel({ taskId: 'task-id' }));
|
||||||
});
|
});
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { HttpModule } from '@angular/http';
|
import { ReflectiveInjector } from '@angular/core';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { AlfrescoApi } from 'alfresco-js-api';
|
||||||
import {
|
import {
|
||||||
formTest,
|
formTest,
|
||||||
fakeTaskProcessVariableModels,
|
fakeTaskProcessVariableModels,
|
||||||
@ -24,31 +24,41 @@ import {
|
|||||||
fakeFormJson
|
fakeFormJson
|
||||||
} from './assets/widget-visibility.service.mock';
|
} from './assets/widget-visibility.service.mock';
|
||||||
import { WidgetVisibilityService } from './widget-visibility.service';
|
import { WidgetVisibilityService } from './widget-visibility.service';
|
||||||
import { CoreModule } from 'ng2-alfresco-core';
|
import {
|
||||||
|
AlfrescoAuthenticationService,
|
||||||
|
AlfrescoSettingsService,
|
||||||
|
AlfrescoApiService,
|
||||||
|
StorageService
|
||||||
|
} from 'ng2-alfresco-core';
|
||||||
import { TaskProcessVariableModel } from '../models/task-process-variable.model';
|
import { TaskProcessVariableModel } from '../models/task-process-variable.model';
|
||||||
import { WidgetVisibilityModel } from '../models/widget-visibility.model';
|
import { WidgetVisibilityModel } from '../models/widget-visibility.model';
|
||||||
import { FormModel, FormFieldModel, TabModel, ContainerModel, FormFieldTypes } from '../components/widgets/core/index';
|
import { FormModel, FormFieldModel, TabModel, ContainerModel, FormFieldTypes } from '../components/widgets/core/index';
|
||||||
import { FormService } from './form.service';
|
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
describe('WidgetVisibilityService', () => {
|
describe('WidgetVisibilityService', () => {
|
||||||
let service: WidgetVisibilityService;
|
let service, injector;
|
||||||
|
let authenticationService: AlfrescoAuthenticationService;
|
||||||
|
let apiService: AlfrescoApiService;
|
||||||
|
let alfrescoApi: AlfrescoApi;
|
||||||
let booleanResult: boolean;
|
let booleanResult: boolean;
|
||||||
let stubFormWithFields = new FormModel(fakeFormJson);
|
let stubFormWithFields = new FormModel(fakeFormJson);
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
injector = ReflectiveInjector.resolveAndCreate([
|
||||||
imports: [ HttpModule, CoreModule ],
|
WidgetVisibilityService,
|
||||||
providers: [
|
AlfrescoSettingsService,
|
||||||
WidgetVisibilityService,
|
AlfrescoApiService,
|
||||||
FormService
|
AlfrescoAuthenticationService,
|
||||||
]
|
StorageService
|
||||||
});
|
]);
|
||||||
service = TestBed.get(WidgetVisibilityService);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
service = injector.get(WidgetVisibilityService);
|
||||||
|
authenticationService = injector.get(AlfrescoAuthenticationService);
|
||||||
|
apiService = injector.get(AlfrescoApiService);
|
||||||
|
alfrescoApi = apiService.getInstance();
|
||||||
jasmine.Ajax.install();
|
jasmine.Ajax.install();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -193,7 +203,7 @@ describe('WidgetVisibilityService', () => {
|
|||||||
|
|
||||||
it('should return the process variables for task', (done) => {
|
it('should return the process variables for task', (done) => {
|
||||||
service.getTaskProcessVariable('9999').subscribe(
|
service.getTaskProcessVariable('9999').subscribe(
|
||||||
(res: TaskProcessVariableModel[]) => {
|
(res) => {
|
||||||
expect(res).toBeDefined();
|
expect(res).toBeDefined();
|
||||||
expect(res.length).toEqual(3);
|
expect(res.length).toEqual(3);
|
||||||
expect(res[0].id).toEqual('TEST_VAR_1');
|
expect(res[0].id).toEqual('TEST_VAR_1');
|
||||||
@ -444,11 +454,10 @@ describe('WidgetVisibilityService', () => {
|
|||||||
expect(leftValue).toBe('value_2');
|
expect(leftValue).toBe('value_2');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return empty string for a value that is not on variable or form', () => {
|
it('should return undefined for a value that is not on variable or form', () => {
|
||||||
let leftValue = service.getLeftValue(fakeFormWithField, visibilityObjTest);
|
let leftValue = service.getLeftValue(fakeFormWithField, visibilityObjTest);
|
||||||
|
|
||||||
expect(leftValue).not.toBeUndefined();
|
expect(leftValue).toBeUndefined();
|
||||||
expect(leftValue).toBe('');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should evaluate the visibility for the field with single visibility condition between two field values', () => {
|
it('should evaluate the visibility for the field with single visibility condition between two field values', () => {
|
||||||
@ -620,30 +629,30 @@ describe('WidgetVisibilityService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
it('should refresh the visibility for field', () => {
|
it('should refresh the visibility for field', () => {
|
||||||
visibilityObjTest.leftFormFieldId = 'FIELD_TEST';
|
visibilityObjTest.leftFormFieldId = 'FIELD_TEST';
|
||||||
visibilityObjTest.operator = '!=';
|
visibilityObjTest.operator = '!=';
|
||||||
visibilityObjTest.rightFormFieldId = 'RIGHT_FORM_FIELD_ID';
|
visibilityObjTest.rightFormFieldId = 'RIGHT_FORM_FIELD_ID';
|
||||||
|
|
||||||
let container = <ContainerModel> fakeFormWithField.fields[0];
|
let container = <ContainerModel> fakeFormWithField.fields[0];
|
||||||
let column0 = container.columns[0];
|
let column0 = container.columns[0];
|
||||||
let column1 = container.columns[1];
|
let column1 = container.columns[1];
|
||||||
|
|
||||||
column0.fields[0].visibilityCondition = visibilityObjTest;
|
column0.fields[0].visibilityCondition = visibilityObjTest;
|
||||||
service.refreshVisibility(fakeFormWithField);
|
service.refreshVisibility(fakeFormWithField);
|
||||||
|
|
||||||
expect(column0.fields[0].isVisible).toBeFalsy();
|
expect(column0.fields[0].isVisible).toBeFalsy();
|
||||||
expect(column0.fields[1].isVisible).toBeTruthy();
|
expect(column0.fields[1].isVisible).toBeTruthy();
|
||||||
expect(column0.fields[2].isVisible).toBeTruthy();
|
expect(column0.fields[2].isVisible).toBeTruthy();
|
||||||
expect(column1.fields[0].isVisible).toBeTruthy();
|
expect(column1.fields[0].isVisible).toBeTruthy();
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
it('should refresh the visibility for tab in forms', () => {
|
it('should refresh the visibility for tab in forms', () => {
|
||||||
visibilityObjTest.leftFormFieldId = 'FIELD_TEST';
|
visibilityObjTest.leftFormFieldId = 'FIELD_TEST';
|
||||||
visibilityObjTest.operator = '!=';
|
visibilityObjTest.operator = '!=';
|
||||||
visibilityObjTest.rightFormFieldId = 'RIGHT_FORM_FIELD_ID';
|
visibilityObjTest.rightFormFieldId = 'RIGHT_FORM_FIELD_ID';
|
||||||
let tab = new TabModel(fakeFormWithField, {id: 'fake-tab-id', title: 'fake-tab-title', isVisible: true});
|
let tab = new TabModel(fakeFormWithField, { id: 'fake-tab-id', title: 'fake-tab-title', isVisible: true });
|
||||||
tab.visibilityCondition = visibilityObjTest;
|
tab.visibilityCondition = visibilityObjTest;
|
||||||
fakeFormWithField.tabs.push(tab);
|
fakeFormWithField.tabs.push(tab);
|
||||||
service.refreshVisibility(fakeFormWithField);
|
service.refreshVisibility(fakeFormWithField);
|
||||||
@ -655,7 +664,7 @@ describe('WidgetVisibilityService', () => {
|
|||||||
visibilityObjTest.leftFormFieldId = 'FIELD_TEST';
|
visibilityObjTest.leftFormFieldId = 'FIELD_TEST';
|
||||||
visibilityObjTest.operator = '!=';
|
visibilityObjTest.operator = '!=';
|
||||||
visibilityObjTest.rightFormFieldId = 'RIGHT_FORM_FIELD_ID';
|
visibilityObjTest.rightFormFieldId = 'RIGHT_FORM_FIELD_ID';
|
||||||
let tab = new TabModel(fakeFormWithField, {id: 'fake-tab-id', title: 'fake-tab-title', isVisible: true});
|
let tab = new TabModel(fakeFormWithField, { id: 'fake-tab-id', title: 'fake-tab-title', isVisible: true });
|
||||||
tab.visibilityCondition = visibilityObjTest;
|
tab.visibilityCondition = visibilityObjTest;
|
||||||
service.refreshEntityVisibility(tab);
|
service.refreshEntityVisibility(tab);
|
||||||
|
|
||||||
|
@ -16,9 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Response, Http, Headers, RequestOptions } from '@angular/http';
|
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
||||||
import {
|
import {
|
||||||
FormModel,
|
FormModel,
|
||||||
FormFieldModel,
|
FormFieldModel,
|
||||||
@ -35,9 +34,7 @@ export class WidgetVisibilityService {
|
|||||||
|
|
||||||
private processVarList: TaskProcessVariableModel[];
|
private processVarList: TaskProcessVariableModel[];
|
||||||
|
|
||||||
constructor(private http: Http,
|
constructor(private apiService: AlfrescoApiService) {
|
||||||
private alfrescoSettingsService: AlfrescoSettingsService,
|
|
||||||
private authService: AlfrescoAuthenticationService) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public refreshVisibility(form: FormModel) {
|
public refreshVisibility(form: FormModel) {
|
||||||
@ -80,10 +77,14 @@ export class WidgetVisibilityService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getLeftValue(form: FormModel, visibilityObj: WidgetVisibilityModel) {
|
getLeftValue(form: FormModel, visibilityObj: WidgetVisibilityModel) {
|
||||||
|
let leftValue = '';
|
||||||
if (visibilityObj.leftRestResponseId && visibilityObj.leftRestResponseId !== 'null') {
|
if (visibilityObj.leftRestResponseId && visibilityObj.leftRestResponseId !== 'null') {
|
||||||
return this.getVariableValue(form, visibilityObj.leftRestResponseId, this.processVarList);
|
leftValue = this.getVariableValue(form, visibilityObj.leftRestResponseId, this.processVarList);
|
||||||
|
} else {
|
||||||
|
leftValue = this.getFormValue(form, visibilityObj.leftFormFieldId);
|
||||||
|
leftValue = leftValue ? leftValue : this.getVariableValue(form, visibilityObj.leftFormFieldId, this.processVarList);
|
||||||
}
|
}
|
||||||
return this.getFormValue(form, visibilityObj.leftFormFieldId);
|
return leftValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRightValue(form: FormModel, visibilityObj: WidgetVisibilityModel) {
|
getRightValue(form: FormModel, visibilityObj: WidgetVisibilityModel) {
|
||||||
@ -231,29 +232,21 @@ export class WidgetVisibilityService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTaskProcessVariable(taskId: string): Observable<TaskProcessVariableModel[]> {
|
getTaskProcessVariable(taskId: string): Observable<TaskProcessVariableModel[]> {
|
||||||
let url = `${this.alfrescoSettingsService.getBPMApiBaseUrl()}/app/rest/task-forms/${taskId}/variables`;
|
return Observable.fromPromise(this.apiService.getInstance().activiti.taskFormsApi.getTaskFormVariables(taskId))
|
||||||
let options = this.getRequestOptions();
|
.map(res => {
|
||||||
return this.http
|
let jsonRes = this.toJson(res);
|
||||||
.get(url, options)
|
this.processVarList = <TaskProcessVariableModel[]>jsonRes;
|
||||||
.map((response: Response) => this.processVarList = <TaskProcessVariableModel[]> response.json())
|
return jsonRes;
|
||||||
|
})
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getHeaders(): Headers {
|
toJson(res: any) {
|
||||||
return new Headers({
|
return res || {};
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Authorization': this.authService.getTicketBpm()
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getRequestOptions(): RequestOptions {
|
private handleError() {
|
||||||
let headers = this.getHeaders();
|
console.error('Error while performing a call');
|
||||||
return new RequestOptions({headers: headers});
|
return Observable.throw('Error while performing a call - Server error');
|
||||||
}
|
|
||||||
|
|
||||||
private handleError(error: Response) {
|
|
||||||
console.error(error);
|
|
||||||
return Observable.throw(error.json().error || 'Server error');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { ReflectiveInjector } from '@angular/core';
|
||||||
import { BpmUserService } from '../services/bpm-user.service';
|
import { BpmUserService } from '../services/bpm-user.service';
|
||||||
// import { BpmUserModel } from '../models/bpm-user.model';
|
|
||||||
import { AlfrescoAuthenticationService, AlfrescoApiService, AlfrescoSettingsService, StorageService } from 'ng2-alfresco-core';
|
import { AlfrescoAuthenticationService, AlfrescoApiService, AlfrescoSettingsService, StorageService } from 'ng2-alfresco-core';
|
||||||
import { fakeBpmUser } from '../assets/fake-bpm-user.service.mock';
|
import { fakeBpmUser } from '../assets/fake-bpm-user.service.mock';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user