mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-6227] cleanup error handling and fix typing issues (#9035)
* cleanup audit service, remove useless ajax tests * cleanup sites service and remove useless ajax tests * cleanup services * cleanup services * fix typings * code cleanup
This commit is contained in:
@@ -15,41 +15,26 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService, LogService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { ModelJsonBpmnApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class DiagramsService {
|
||||
|
||||
private _modelJsonBpmnApi: ModelJsonBpmnApi;
|
||||
get modelJsonBpmnApi(): ModelJsonBpmnApi {
|
||||
this._modelJsonBpmnApi = this._modelJsonBpmnApi ?? new ModelJsonBpmnApi(this.apiService.getInstance());
|
||||
return this._modelJsonBpmnApi;
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
}
|
||||
constructor(private apiService: AlfrescoApiService) {}
|
||||
|
||||
getProcessDefinitionModel(processDefinitionId: string): Observable<any> {
|
||||
return from(this.modelJsonBpmnApi.getModelJSON(processDefinitionId))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
return from(this.modelJsonBpmnApi.getModelJSON(processDefinitionId));
|
||||
}
|
||||
|
||||
getRunningProcessDefinitionModel(processInstanceId: string): Observable<any> {
|
||||
return from(this.modelJsonBpmnApi.getModelJSONForProcessDefinition(processInstanceId))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
}
|
||||
|
||||
private handleError(error: any) {
|
||||
this.logService.error(error);
|
||||
return throwError(error || 'Server error');
|
||||
return from(this.modelJsonBpmnApi.getModelJSONForProcessDefinition(processInstanceId));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user