mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
fix error handling and "this" context (#1445)
* fix error handling and "this" context * fix typo
This commit is contained in:
parent
dd6baed74b
commit
0ee5c9846a
@ -42,14 +42,14 @@ export class AnalyticsService {
|
||||
reports.push(reportModel);
|
||||
});
|
||||
return reports;
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
getReportParams(reportId: string): Observable<any> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.getReportParams(reportId))
|
||||
.map((res: any) => {
|
||||
return new ReportParametersModel(res);
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
getParamValuesByType(type: string, appId: string, reportId?: string, processDefinitionId?: string) {
|
||||
@ -122,7 +122,7 @@ export class AnalyticsService {
|
||||
paramOptions.push(new ParameterValueModel(opt));
|
||||
});
|
||||
return paramOptions;
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
getProcessDefinitionsValues(appId: string): Observable<any> {
|
||||
@ -133,7 +133,7 @@ export class AnalyticsService {
|
||||
paramOptions.push(new ParameterValueModel(opt));
|
||||
});
|
||||
return paramOptions;
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
getTasksByProcessDefinitionId(reportId: string, processDefinitionId: string): Observable<any> {
|
||||
@ -144,7 +144,7 @@ export class AnalyticsService {
|
||||
paramOptions.push(new ParameterValueModel({ id: opt, name: opt }));
|
||||
});
|
||||
return paramOptions;
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
getReportsByParams(reportId: number, paramsQuery: any): Observable<any> {
|
||||
@ -168,20 +168,20 @@ export class AnalyticsService {
|
||||
});
|
||||
|
||||
return elements;
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
createDefaultReports(): Observable<any> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.createDefaultReports())
|
||||
.map(this.toJson)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
updateReport(reportId: number, name: string): Observable<any> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.updateReport(reportId, name))
|
||||
.map((res: any) => {
|
||||
this.logService.info('upload');
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
private handleError(error: Response) {
|
||||
|
@ -37,7 +37,7 @@ export class DiagramsService {
|
||||
.map((res: any) => {
|
||||
let body = res.json();
|
||||
return body;
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
public getHeaders(): Headers {
|
||||
|
@ -105,9 +105,7 @@ export class ActivitiStartForm extends ActivitiForm implements AfterViewChecked,
|
||||
// this.form.processDefinitionId = this.processDefinitionId;
|
||||
this.formLoaded.emit(this.form);
|
||||
},
|
||||
(error) => {
|
||||
this.handleError(error);
|
||||
}
|
||||
error => this.handleError(error)
|
||||
);
|
||||
}
|
||||
|
||||
@ -120,9 +118,7 @@ export class ActivitiStartForm extends ActivitiForm implements AfterViewChecked,
|
||||
this.form = this.parseForm(form);
|
||||
this.formLoaded.emit(this.form);
|
||||
},
|
||||
(error) => {
|
||||
this.handleError(error);
|
||||
}
|
||||
error => this.handleError(error)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ export class DropdownWidget extends WidgetComponent implements OnInit {
|
||||
this.field.options = options.concat((result || []));
|
||||
this.field.updateForm();
|
||||
},
|
||||
this.handleError
|
||||
err => this.handleError(err)
|
||||
);
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ export class DropdownWidget extends WidgetComponent implements OnInit {
|
||||
this.field.options = options.concat((result || []));
|
||||
this.field.updateForm();
|
||||
},
|
||||
this.handleError
|
||||
err => this.handleError(err)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ export class RadioButtonsWidget extends WidgetComponent implements OnInit {
|
||||
this.field.options = result || [];
|
||||
this.field.updateForm();
|
||||
},
|
||||
this.handleError
|
||||
err => this.handleError(err)
|
||||
);
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ export class RadioButtonsWidget extends WidgetComponent implements OnInit {
|
||||
this.field.options = result || [];
|
||||
this.field.updateForm();
|
||||
},
|
||||
this.handleError
|
||||
err => this.handleError(err)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ export class TypeaheadWidget extends WidgetComponent implements OnInit {
|
||||
this.field.updateForm();
|
||||
this.visibilityService.refreshEntityVisibility(this.field);
|
||||
},
|
||||
this.handleError
|
||||
err => this.handleError(err)
|
||||
);
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ export class TypeaheadWidget extends WidgetComponent implements OnInit {
|
||||
this.field.updateForm();
|
||||
this.visibilityService.refreshEntityVisibility(this.field);
|
||||
},
|
||||
this.handleError
|
||||
err => this.handleError(err)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ export class ActivitiAlfrescoContentService {
|
||||
let accountShortId = accountId.replace('alfresco-', '');
|
||||
return Observable.fromPromise(apiService.activiti.alfrescoApi.getContentInFolder(accountShortId, folderId))
|
||||
.map(this.toJsonArray)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,7 +63,7 @@ export class ActivitiAlfrescoContentService {
|
||||
simpleType: node.simpleType,
|
||||
source: accountId,
|
||||
sourceId: node.id + '@' + siteId
|
||||
})).map(this.toJson).catch(this.handleError);
|
||||
})).map(this.toJson).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
toJson(res: any) {
|
||||
|
@ -49,10 +49,11 @@ export class FormService {
|
||||
this.addFieldsToAForm(form.id, formDefinitionModel).subscribe(formData => {
|
||||
observer.next(formData);
|
||||
observer.complete();
|
||||
}, this.handleError);
|
||||
}, err => this.handleError(err));
|
||||
},
|
||||
this.handleError);
|
||||
}, this.handleError);
|
||||
err => this.handleError(err));
|
||||
},
|
||||
err => this.handleError(err));
|
||||
});
|
||||
}
|
||||
|
||||
@ -88,9 +89,13 @@ export class FormService {
|
||||
'modelType': 2
|
||||
};
|
||||
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.modelsApi.getModels(opts)).map(function (forms: any) {
|
||||
return Observable.fromPromise(
|
||||
this.apiService.getInstance().activiti.modelsApi.getModels(opts))
|
||||
.map(function (forms: any) {
|
||||
return forms.data.find(formdata => formdata.name === name);
|
||||
}).catch(this.handleError);
|
||||
})
|
||||
.catch(err => this.handleError(err)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -112,7 +117,7 @@ export class FormService {
|
||||
getProcessDefinitions(): Observable<any> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.processApi.getProcessDefinitions({}))
|
||||
.map(this.toJsonArray)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,7 +128,7 @@ export class FormService {
|
||||
getTasks(): Observable<any> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.listTasks({}))
|
||||
.map(this.toJsonArray)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -134,7 +139,7 @@ export class FormService {
|
||||
getTask(taskId: string): Observable<any> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.getTask(taskId))
|
||||
.map(this.toJson)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,7 +152,7 @@ export class FormService {
|
||||
let body = JSON.stringify({values: formValues});
|
||||
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.saveTaskForm(taskId, body))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,7 +170,7 @@ export class FormService {
|
||||
let body = JSON.stringify(data);
|
||||
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.completeTaskForm(taskId, body))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -176,7 +181,7 @@ export class FormService {
|
||||
getTaskForm(taskId: string): Observable<any> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.getTaskForm(taskId))
|
||||
.map(this.toJson)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,7 +192,7 @@ export class FormService {
|
||||
getFormDefinitionById(formId: string): Observable<any> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.editorApi.getForm(formId))
|
||||
.map(this.toJson)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -204,7 +209,7 @@ export class FormService {
|
||||
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.modelsApi.getModels(opts))
|
||||
.map(this.getFormId)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -216,7 +221,7 @@ export class FormService {
|
||||
return Observable.fromPromise(
|
||||
this.apiService.getInstance().activiti.processApi.getProcessInstanceStartForm(processId))
|
||||
.map(this.toJson)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -228,7 +233,7 @@ export class FormService {
|
||||
return Observable.fromPromise(
|
||||
this.apiService.getInstance().activiti.processApi.getProcessDefinitionStartForm(processId))
|
||||
.map(this.toJson)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -237,14 +237,14 @@ export class WidgetVisibilityService {
|
||||
this.processVarList = <TaskProcessVariableModel[]>jsonRes;
|
||||
return jsonRes;
|
||||
})
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
toJson(res: any) {
|
||||
return res || {};
|
||||
}
|
||||
|
||||
private handleError() {
|
||||
private handleError(err) {
|
||||
this.logService.error('Error while performing a call');
|
||||
return Observable.throw('Error while performing a call - Server error');
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ export class ActivitiProcessService {
|
||||
getDeployedApplications(name: string): Observable<AppDefinitionRepresentationModel> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.appsApi.getAppDefinitions())
|
||||
.map((response: any) => response.data.find((p: AppDefinitionRepresentationModel) => p.name === name))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
getProcessInstances(requestNode: ProcessFilterRequestRepresentation): Observable<ProcessInstance[]> {
|
||||
@ -50,7 +50,7 @@ export class ActivitiProcessService {
|
||||
} else {
|
||||
return res.data;
|
||||
}
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
getProcessFilters(appId: number): Observable<FilterProcessRepresentationModel[]> {
|
||||
@ -69,7 +69,7 @@ export class ActivitiProcessService {
|
||||
}
|
||||
return filters;
|
||||
})
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -148,12 +148,12 @@ export class ActivitiProcessService {
|
||||
addFilter(filter: FilterProcessRepresentationModel): Observable<FilterProcessRepresentationModel> {
|
||||
delete filter.filter.assignment;
|
||||
return Observable.fromPromise(this.callApiAddFilter(filter))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
getProcess(id: string): Observable<ProcessInstance> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.processApi.getProcessInstance(id))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
getProcessTasks(id: string, state?: string): Observable<TaskDetailsModel[]> {
|
||||
@ -169,7 +169,7 @@ export class ActivitiProcessService {
|
||||
task.created = moment(task.created, 'YYYY-MM-DD').format();
|
||||
return task;
|
||||
}))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -192,7 +192,7 @@ export class ActivitiProcessService {
|
||||
comments.push(new Comment(comment.id, comment.message, comment.created, user));
|
||||
});
|
||||
return comments;
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -207,7 +207,7 @@ export class ActivitiProcessService {
|
||||
)
|
||||
.map((response: Comment) => {
|
||||
return new Comment(response.id, response.message, response.created, response.createdBy);
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ export class ActivitiProcessService {
|
||||
)
|
||||
.map(this.extractData)
|
||||
.map(processDefs => processDefs.map((pd) => new ProcessDefinitionRepresentation(pd)))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
startProcess(processDefinitionId: string, name: string, outcome?: string, startFormValues?: any): Observable<ProcessInstance> {
|
||||
@ -241,14 +241,14 @@ export class ActivitiProcessService {
|
||||
this.apiService.getInstance().activiti.processApi.startNewProcessInstance(startRequest)
|
||||
)
|
||||
.map((pd) => new ProcessInstance(pd))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
cancelProcess(processInstanceId: string): Observable<void> {
|
||||
return Observable.fromPromise(
|
||||
this.apiService.getInstance().activiti.processApi.deleteProcessInstance(processInstanceId)
|
||||
)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
getProcessInstanceVariables(processDefinitionId: string): Observable<ProcessInstanceVariable[]> {
|
||||
@ -256,21 +256,21 @@ export class ActivitiProcessService {
|
||||
this.apiService.getInstance().activiti.processInstanceVariablesApi.getProcessInstanceVariables(processDefinitionId)
|
||||
)
|
||||
.map((processVars: any[]) => processVars.map((pd) => new ProcessInstanceVariable(pd)))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
createOrUpdateProcessInstanceVariables(processDefinitionId: string, variables: ProcessInstanceVariable[]): Observable<ProcessInstanceVariable[]> {
|
||||
return Observable.fromPromise(
|
||||
this.apiService.getInstance().activiti.processInstanceVariablesApi.createOrUpdateProcessInstanceVariables(processDefinitionId, variables)
|
||||
)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
deleteProcessInstanceVariable(processDefinitionId: string, variableName: string): Observable<void> {
|
||||
return Observable.fromPromise(
|
||||
this.apiService.getInstance().activiti.processInstanceVariablesApi.deleteProcessInstanceVariable(processDefinitionId, variableName)
|
||||
)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
private callApiGetUserProcessInstanceFilters(filterOpts) {
|
||||
|
@ -32,19 +32,19 @@ export class ActivitiPeopleService {
|
||||
let option = {excludeTaskId: taskId, filter: searchWord};
|
||||
return Observable.fromPromise(this.getWorkflowUserApi(option))
|
||||
.map((response: any) => <User[]> response.data || [])
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
involveUserWithTask(taskId: string, idToInvolve: string): Observable<User[]> {
|
||||
let node = {userId: idToInvolve};
|
||||
return Observable.fromPromise(this.involveUserToTaskApi(taskId, node))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
removeInvolvedUser(taskId: string, idToRemove: string): Observable<User[]> {
|
||||
let node = {userId: idToRemove};
|
||||
return Observable.fromPromise(this.removeInvolvedUserFromTaskApi(taskId, node))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
private getWorkflowUserApi(options: any) {
|
||||
|
@ -43,7 +43,7 @@ export class ActivitiTaskListService {
|
||||
}
|
||||
return response.data;
|
||||
})
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,7 +62,7 @@ export class ActivitiTaskListService {
|
||||
return this.createDefaultFilter(appId);
|
||||
}
|
||||
return filters;
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +78,7 @@ export class ActivitiTaskListService {
|
||||
} else {
|
||||
return res.data;
|
||||
}
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,7 +91,7 @@ export class ActivitiTaskListService {
|
||||
.map(res => res)
|
||||
.map((details: any) => {
|
||||
return new TaskDetailsModel(details);
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,7 +109,7 @@ export class ActivitiTaskListService {
|
||||
comments.push(new Comment(comment.id, comment.message, comment.created, user));
|
||||
});
|
||||
return comments;
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,7 +126,7 @@ export class ActivitiTaskListService {
|
||||
checklists.push(new TaskDetailsModel(checklist));
|
||||
});
|
||||
return checklists;
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,7 +147,7 @@ export class ActivitiTaskListService {
|
||||
forms.push(new Form(form.id, form.name));
|
||||
});
|
||||
return forms;
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
attachFormToATask(taskId: string, formId: number): Observable<any> {
|
||||
@ -191,7 +191,7 @@ export class ActivitiTaskListService {
|
||||
.map(res => res)
|
||||
.map((response: TaskDetailsModel) => {
|
||||
return new TaskDetailsModel(response);
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -204,7 +204,7 @@ export class ActivitiTaskListService {
|
||||
.map(res => res)
|
||||
.map((response: FilterRepresentationModel) => {
|
||||
return response;
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -218,7 +218,7 @@ export class ActivitiTaskListService {
|
||||
.map(res => res)
|
||||
.map((response: Comment) => {
|
||||
return new Comment(response.id, response.message, response.created, response.createdBy);
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
|
||||
}
|
||||
|
||||
@ -242,7 +242,7 @@ export class ActivitiTaskListService {
|
||||
return Observable.fromPromise(this.callApiTasksFiltered(requestNode))
|
||||
.map((res: any) => {
|
||||
return res;
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -255,7 +255,7 @@ export class ActivitiTaskListService {
|
||||
.map(res => res)
|
||||
.map((response: TaskDetailsModel) => {
|
||||
return new TaskDetailsModel(response);
|
||||
}).catch(this.handleError);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -264,7 +264,7 @@ export class ActivitiTaskListService {
|
||||
*/
|
||||
claimTask(taskId: string): Observable<TaskDetailsModel> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.claimTask(taskId))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
private callApiTasksFiltered(requestNode: TaskQueryRequestRepresentationModel) {
|
||||
|
@ -63,17 +63,17 @@ export class RenditionsService {
|
||||
|
||||
getRendition(nodeId: string, encoding: string) {
|
||||
return Observable.fromPromise(this.apiService.getInstance().core.renditionsApi.getRendition(nodeId, encoding))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
getRenditionsListByNodeId(nodeId: string) {
|
||||
return Observable.fromPromise(this.apiService.getInstance().core.renditionsApi.getRenditions(nodeId))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
createRendition(nodeId: string, encoding: string) {
|
||||
return Observable.fromPromise(this.apiService.getInstance().core.renditionsApi.createRendition(nodeId, {id: encoding}))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
private handleError(error: any): Observable<any> {
|
||||
|
@ -103,7 +103,7 @@ export class DocumentListService {
|
||||
*/
|
||||
createFolder(name: string, parentId: string): Observable<MinimalNodeEntity> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().nodes.createFolder(name, '/', parentId))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,7 +115,7 @@ export class DocumentListService {
|
||||
getFolder(folder: string, opts?: any) {
|
||||
return Observable.fromPromise(this.getNodesPromise(folder, opts))
|
||||
.map(res => <NodePaging> res)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
getFolderNode(nodeId: string): Promise<MinimalNodeEntryEntity> {
|
||||
|
@ -39,7 +39,7 @@ export class AlfrescoSearchService {
|
||||
public getNodeQueryResults(term: string, options?: SearchOptions): Observable<any> {
|
||||
return Observable.fromPromise(this.getQueryNodesPromise(term, options))
|
||||
.map(res => <any> res)
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
private getQueryNodesPromise(term: string, opts: SearchOptions) {
|
||||
|
@ -37,12 +37,12 @@ export class TagService {
|
||||
|
||||
getTagsByNodeId(nodeId: string): any {
|
||||
return Observable.fromPromise(this.apiService.getInstance().core.tagsApi.getNodeTags(nodeId))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
getAllTheTags() {
|
||||
return Observable.fromPromise(this.apiService.getInstance().core.tagsApi.getTags())
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
addTag(nodeId: string, tagName: string): any {
|
||||
@ -51,12 +51,12 @@ export class TagService {
|
||||
tagBody.tag = tagName;
|
||||
|
||||
return Observable.fromPromise(this.apiService.getInstance().core.tagsApi.addTag(nodeId, tagBody))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
removeTag(nodeId: string, tag: string): any {
|
||||
return Observable.fromPromise(this.apiService.getInstance().core.tagsApi.removeTag(nodeId, tag))
|
||||
.catch(this.handleError);
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
private handleError(error: any) {
|
||||
|
@ -167,7 +167,7 @@ export class UploadService {
|
||||
return res;
|
||||
})
|
||||
.do(data => this.logService.info('Node data', data)) // eyeball results in the console
|
||||
.catch((err) => this.handleError(err));
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
private callApiCreateFolder(relativePath: string, name: string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user