mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1724] Remove all log in favor of log service (#2465)
* remove console log from components * remove console log from demo shell * fix visibility issue * fix error template * remove console.log from spec * fix tests * fix test
This commit is contained in:
@@ -41,6 +41,7 @@ import {
|
||||
TaskListComponent,
|
||||
TaskListService
|
||||
} from 'ng2-activiti-tasklist';
|
||||
import { LogService } from 'ng2-alfresco-core';
|
||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
||||
import {
|
||||
DataSorting,
|
||||
@@ -133,6 +134,7 @@ export class ActivitiDemoComponent implements AfterViewInit, OnDestroy, OnInit {
|
||||
private router: Router,
|
||||
private taskListService: TaskListService,
|
||||
private apiService: AlfrescoApiService,
|
||||
private logService: LogService,
|
||||
formRenderingService: FormRenderingService,
|
||||
formService: FormService) {
|
||||
this.dataTasks = new ObjectDataTableAdapter();
|
||||
@@ -154,11 +156,11 @@ export class ActivitiDemoComponent implements AfterViewInit, OnDestroy, OnInit {
|
||||
formRenderingService.setComponentTypeResolver('custom_stencil_01', () => CustomStencil01, true);
|
||||
|
||||
formService.formLoaded.subscribe((e: FormEvent) => {
|
||||
console.log(`Form loaded: ${e.form.id}`);
|
||||
this.logService.log(`Form loaded: ${e.form.id}`);
|
||||
});
|
||||
|
||||
formService.formFieldValueChanged.subscribe((e: FormFieldEvent) => {
|
||||
console.log(`Field value changed. Form: ${e.form.id}, Field: ${e.field.id}, Value: ${e.field.value}`);
|
||||
this.logService.log(`Field value changed. Form: ${e.form.id}, Field: ${e.field.id}, Value: ${e.field.value}`);
|
||||
});
|
||||
|
||||
formService.validateDynamicTableRow.subscribe(
|
||||
@@ -175,8 +177,8 @@ export class ActivitiDemoComponent implements AfterViewInit, OnDestroy, OnInit {
|
||||
// Uncomment this block to see form event handling in action
|
||||
/*
|
||||
formService.formEvents.subscribe((event: Event) => {
|
||||
console.log('Event fired:' + event.type);
|
||||
console.log('Event Target:' + event.target);
|
||||
this.logService.log('Event fired:' + event.type);
|
||||
this.logService.log('Event Target:' + event.target);
|
||||
});
|
||||
*/
|
||||
}
|
||||
@@ -213,9 +215,9 @@ export class ActivitiDemoComponent implements AfterViewInit, OnDestroy, OnInit {
|
||||
this.taskListService.tasksList$.subscribe(
|
||||
(tasks) => {
|
||||
this.taskPagination = { count: tasks.data.length, maxItems: this.taskPagination.maxItems, skipCount: this.taskPagination.skipCount, totalItems: tasks.total };
|
||||
console.log({ count: tasks.data.length, maxItems: this.taskPagination.maxItems, skipCount: this.taskPagination.skipCount, totalItems: tasks.total });
|
||||
this.logService.log({ count: tasks.data.length, maxItems: this.taskPagination.maxItems, skipCount: this.taskPagination.skipCount, totalItems: tasks.total });
|
||||
}, (err) => {
|
||||
console.log('err' + err);
|
||||
this.logService.log('err' + err);
|
||||
});
|
||||
|
||||
if (this.router.url.includes('processes')) {
|
||||
@@ -381,11 +383,11 @@ export class ActivitiDemoComponent implements AfterViewInit, OnDestroy, OnInit {
|
||||
}
|
||||
|
||||
onAuditClick(event: any) {
|
||||
console.log(event);
|
||||
this.logService.log(event);
|
||||
}
|
||||
|
||||
onAuditError(event: any): void {
|
||||
console.error('My custom error message' + event);
|
||||
this.logService.error('My custom error message' + event);
|
||||
}
|
||||
|
||||
onTaskCreated(data: any): void {
|
||||
@@ -451,11 +453,11 @@ export class ActivitiDemoComponent implements AfterViewInit, OnDestroy, OnInit {
|
||||
}
|
||||
|
||||
onRowClick(event): void {
|
||||
console.log(event);
|
||||
this.logService.log(event);
|
||||
}
|
||||
|
||||
onRowDblClick(event): void {
|
||||
console.log(event);
|
||||
this.logService.log(event);
|
||||
}
|
||||
|
||||
isTaskCompleted(): boolean {
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
||||
import { AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||
import { DataCellEvent, DataRowActionEvent, DataSorting, ObjectDataColumn, ObjectDataRow, ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
|
||||
@@ -45,7 +45,7 @@ export class DataTableDemoComponent {
|
||||
email: 'denys.vuika@alfresco.com'
|
||||
};
|
||||
|
||||
constructor(private apiService: AlfrescoApiService) {
|
||||
constructor(private apiService: AlfrescoApiService, private logService: LogService) {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
@@ -162,17 +162,17 @@ export class DataTableDemoComponent {
|
||||
|
||||
onExecuteRowAction(event: DataRowActionEvent) {
|
||||
let args = event.value;
|
||||
console.log(args.row);
|
||||
console.log(args.action);
|
||||
this.logService.log(args.row);
|
||||
this.logService.log(args.action);
|
||||
window.alert(`My custom action: ${args.action.title}`);
|
||||
}
|
||||
|
||||
onRowClick(event) {
|
||||
console.log(event);
|
||||
this.logService.log(event);
|
||||
}
|
||||
|
||||
onRowDblClick(event) {
|
||||
console.log(event);
|
||||
this.logService.log(event);
|
||||
}
|
||||
|
||||
getRowForNode() {
|
||||
@@ -183,8 +183,8 @@ export class DataTableDemoComponent {
|
||||
|
||||
Observable.fromPromise(this.apiService.getInstance().nodes
|
||||
.getNodeInfo('-my-', opts)).subscribe((data) => {
|
||||
console.log('FUnNy');
|
||||
console.log(data);
|
||||
this.logService.log('FUnNy');
|
||||
this.logService.log(data);
|
||||
let objects = new ObjectDataTableAdapter([
|
||||
{
|
||||
id: data.id,
|
||||
|
@@ -21,7 +21,7 @@ import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||
import { MinimalNodeEntity } from 'alfresco-js-api';
|
||||
import {
|
||||
AlfrescoApiService, AlfrescoContentService, AlfrescoTranslationService, CreateFolderDialogComponent,
|
||||
DownloadZipDialogComponent, FileUploadEvent, FolderCreatedEvent, NotificationService,
|
||||
DownloadZipDialogComponent, FileUploadEvent, FolderCreatedEvent, LogService, NotificationService,
|
||||
SiteModel, UploadService
|
||||
} from 'ng2-alfresco-core';
|
||||
import { DataColumn, DataRow } from 'ng2-alfresco-datatable';
|
||||
@@ -87,7 +87,8 @@ export class FilesComponent implements OnInit {
|
||||
private dialog: MdDialog,
|
||||
private translateService: AlfrescoTranslationService,
|
||||
private router: Router,
|
||||
@Optional() private route: ActivatedRoute) {
|
||||
@Optional() private route: ActivatedRoute,
|
||||
private logService: LogService) {
|
||||
}
|
||||
|
||||
showFile(event) {
|
||||
@@ -151,8 +152,8 @@ export class FilesComponent implements OnInit {
|
||||
}
|
||||
|
||||
onFolderCreated(event: FolderCreatedEvent) {
|
||||
console.log('FOLDER CREATED');
|
||||
console.log(event);
|
||||
this.logService.log('FOLDER CREATED');
|
||||
this.logService.log(event);
|
||||
if (event && event.parentId === this.documentList.currentFolderId) {
|
||||
this.documentList.reload();
|
||||
}
|
||||
@@ -197,8 +198,8 @@ export class FilesComponent implements OnInit {
|
||||
dialogRef.afterClosed().subscribe(folderName => {
|
||||
if (folderName) {
|
||||
this.contentService.createFolder('', folderName, this.documentList.currentFolderId).subscribe(
|
||||
node => console.log(node),
|
||||
err => console.log(err)
|
||||
node => this.logService.log(node),
|
||||
err => this.logService.log(err)
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -264,7 +265,7 @@ export class FilesComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
console.log(result);
|
||||
this.logService.log(result);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormModel, FormService } from 'ng2-activiti-form';
|
||||
import { LogService } from 'ng2-alfresco-core';
|
||||
import { InMemoryFormService } from '../../services/in-memory-form.service';
|
||||
import { DemoForm } from './demo-form';
|
||||
|
||||
@@ -32,11 +33,11 @@ export class FormDemoComponent implements OnInit {
|
||||
|
||||
form: FormModel;
|
||||
|
||||
constructor(@Inject(FormService) private formService: InMemoryFormService) {
|
||||
constructor(@Inject(FormService) private formService: InMemoryFormService, private logSevice: LogService) {
|
||||
// Prevent default outcome actions
|
||||
formService.executeOutcome.subscribe(e => {
|
||||
e.preventDefault();
|
||||
console.log(e.outcome);
|
||||
this.logSevice.log(e.outcome);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,8 @@
|
||||
<adf-form-list [forms]="formList" (row-dblclick)="onRowDblClick($event)">
|
||||
</adf-form-list>
|
||||
<div class="form-container" *ngIf="!isEmptyForm()">
|
||||
<adf-form [form]="form" [data]="restoredData">
|
||||
</adf-form>
|
||||
</div>
|
||||
<button md-button (click)="store()" color="primary">{{'FORM-LIST.STORE' | translate }}</button>
|
||||
<button md-button (click)="restore()" color="primary">{{'FORM-LIST.RESTORE' | translate }}</button>
|
@@ -0,0 +1,8 @@
|
||||
.form-container {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.store-form-container{
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
}
|
@@ -16,31 +16,13 @@
|
||||
*/
|
||||
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { FormModel, FormService } from 'ng2-activiti-form';
|
||||
import { ActivitiForm } from 'ng2-activiti-form';
|
||||
import { ActivitiForm, FormModel, FormService } from 'ng2-activiti-form';
|
||||
import { LogService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
selector: 'form-list-demo',
|
||||
template: `
|
||||
<adf-form-list [forms]="formList" (row-dblclick)="onRowDblClick($event)">
|
||||
</adf-form-list>
|
||||
<div class="form-container" *ngIf="!isEmptyForm()">
|
||||
<adf-form [form]="form" [data]="restoredData">
|
||||
</adf-form>
|
||||
</div>
|
||||
<button md-button (click)="store()" color="primary">{{'FORM-LIST.STORE' | translate }}</button>
|
||||
<button md-button (click)="restore()" color="primary">{{'FORM-LIST.RESTORE' | translate }}</button>
|
||||
`,
|
||||
styles: [`
|
||||
.form-container {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.store-form-container{
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
}
|
||||
`]
|
||||
templateUrl: 'form-list-demo.component.html',
|
||||
styleUrls: ['form-list-demo.component.scss']
|
||||
})
|
||||
export class FormListDemoComponent {
|
||||
|
||||
@@ -55,11 +37,11 @@ export class FormListDemoComponent {
|
||||
storedData: any = {};
|
||||
restoredData: any = {};
|
||||
|
||||
constructor(private formService: FormService) {
|
||||
constructor(private formService: FormService, private logService: LogService) {
|
||||
// Prevent default outcome actions
|
||||
formService.executeOutcome.subscribe(e => {
|
||||
e.preventDefault();
|
||||
console.log(e.outcome);
|
||||
this.logService.log(e.outcome);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -71,7 +53,7 @@ export class FormListDemoComponent {
|
||||
this.form = form;
|
||||
});
|
||||
|
||||
console.log(rowForm);
|
||||
this.logService.log(rowForm);
|
||||
}
|
||||
|
||||
isEmptyForm() {
|
||||
@@ -80,9 +62,9 @@ export class FormListDemoComponent {
|
||||
|
||||
store() {
|
||||
this.clone(this.activitiForm.form.values, this.storedData);
|
||||
console.log('DATA SAVED');
|
||||
console.log(this.storedData);
|
||||
console.log('DATA SAVED');
|
||||
this.logService.log('DATA SAVED');
|
||||
this.logService.log(this.storedData);
|
||||
this.logService.log('DATA SAVED');
|
||||
this.restoredData = null;
|
||||
}
|
||||
|
||||
|
@@ -53,13 +53,13 @@ export class InMemoryFormService extends FormService {
|
||||
// Uncomment this to use original call
|
||||
// return super.getRestFieldValues(taskId, fieldId);
|
||||
|
||||
console.log(`getRestFieldValues: ${taskId} => ${fieldId}`);
|
||||
this.logService.log(`getRestFieldValues: ${taskId} => ${fieldId}`);
|
||||
return new Observable<FormFieldOption[]>(observer => {
|
||||
let field = this.data.rest.fields.find(
|
||||
f => f.taskId === taskId && f.fieldId === fieldId
|
||||
);
|
||||
let values: FormFieldOption[] = field.values || [];
|
||||
console.log(values);
|
||||
this.logService.log(values);
|
||||
observer.next(values);
|
||||
});
|
||||
}
|
||||
@@ -69,13 +69,13 @@ export class InMemoryFormService extends FormService {
|
||||
// Uncomment this to use original call
|
||||
// return super.getRestFieldValuesByProcessId(processDefinitionId, fieldId);
|
||||
|
||||
console.log(`getRestFieldValuesByProcessId: ${processDefinitionId} => ${fieldId}`);
|
||||
this.logService.log(`getRestFieldValuesByProcessId: ${processDefinitionId} => ${fieldId}`);
|
||||
return new Observable<FormFieldOption[]>(observer => {
|
||||
let field = this.data.rest.fields.find(
|
||||
f => f.processId === processDefinitionId && f.fieldId === fieldId
|
||||
);
|
||||
let values: FormFieldOption[] = field.values || [];
|
||||
console.log(values);
|
||||
this.logService.log(values);
|
||||
observer.next(values);
|
||||
});
|
||||
}
|
||||
|
@@ -40,6 +40,7 @@
|
||||
"no-consecutive-blank-lines": true,
|
||||
"no-console": [
|
||||
true,
|
||||
"log",
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
|
Reference in New Issue
Block a user