mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-7688] Reduce the usage of LogService and TranslateModule (tests) (#9567)
This commit is contained in:
@@ -1 +1 @@
|
||||
<adf-host-settings (cancel)="onCancel()" (success)="onSuccess()" (error)="onError($event)"></adf-host-settings>
|
||||
<adf-host-settings (cancel)="onCancel()" (success)="onSuccess()"></adf-host-settings>
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { LogService } from '@alfresco/adf-core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
@@ -24,14 +23,7 @@ import { Router } from '@angular/router';
|
||||
templateUrl: './settings.component.html'
|
||||
})
|
||||
export class SettingsComponent {
|
||||
|
||||
constructor(private router: Router,
|
||||
public logService: LogService) {
|
||||
}
|
||||
|
||||
onError(error: string) {
|
||||
this.logService.log(error);
|
||||
}
|
||||
constructor(private router: Router) {}
|
||||
|
||||
onCancel() {
|
||||
this.router.navigate(['/login']);
|
||||
|
@@ -16,9 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppConfigService, LogService,
|
||||
FormFieldOption, FormService, FormValues, FormModel,
|
||||
FormOutcomeModel, FormOutcomeEvent } from '@alfresco/adf-core';
|
||||
import { AppConfigService, FormFieldOption, FormService, FormValues, FormModel, FormOutcomeModel, FormOutcomeEvent } from '@alfresco/adf-core';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
|
||||
interface ProcessServiceData {
|
||||
@@ -37,13 +35,11 @@ interface ProcessServiceData {
|
||||
//
|
||||
@Injectable()
|
||||
export class InMemoryFormService extends FormService {
|
||||
|
||||
private data: ProcessServiceData;
|
||||
|
||||
executeOutcome = new Subject<FormOutcomeEvent>();
|
||||
|
||||
constructor(appConfig: AppConfigService,
|
||||
protected logService: LogService) {
|
||||
constructor(appConfig: AppConfigService) {
|
||||
super();
|
||||
this.data = appConfig.get<ProcessServiceData>('activiti');
|
||||
}
|
||||
@@ -53,14 +49,10 @@ export class InMemoryFormService extends FormService {
|
||||
// Uncomment this to use original call
|
||||
// return super.getRestFieldValues(taskId, fieldId);
|
||||
|
||||
this.logService.log(`getRestFieldValues: ${taskId} => ${field}`);
|
||||
return new Observable<FormFieldOption[]>((observer) => {
|
||||
const currentField = this.data.rest.fields.find(
|
||||
(f) => f.taskId === taskId && f.fieldId === field
|
||||
);
|
||||
if ( currentField ) {
|
||||
const currentField = this.data.rest.fields.find((f) => f.taskId === taskId && f.fieldId === field);
|
||||
if (currentField) {
|
||||
const values: FormFieldOption[] = currentField.values || [];
|
||||
this.logService.log(values);
|
||||
observer.next(values);
|
||||
}
|
||||
});
|
||||
@@ -75,7 +67,7 @@ export class InMemoryFormService extends FormService {
|
||||
delete flattenForm.formDefinition;
|
||||
|
||||
const formValues: FormValues = {};
|
||||
(data || []).forEach(variable => {
|
||||
(data || []).forEach((variable) => {
|
||||
formValues[variable.name] = variable.value;
|
||||
});
|
||||
|
||||
@@ -99,13 +91,11 @@ export class InMemoryFormService extends FormService {
|
||||
// Uncomment this to use original call
|
||||
// return super.getRestFieldValuesByProcessId(processDefinitionId, fieldId);
|
||||
|
||||
this.logService.log(`getRestFieldValuesByProcessId: ${processDefinitionId} => ${fieldId}`);
|
||||
return new Observable<FormFieldOption[]>((observer) => {
|
||||
const field = this.data.rest.fields.find(
|
||||
(currentField) => currentField.processId === processDefinitionId && currentField.fieldId === fieldId
|
||||
);
|
||||
const values: FormFieldOption[] = field.values || [];
|
||||
this.logService.log(values);
|
||||
observer.next(values);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user