mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Migrate from window.console to LogService
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Http } from '@angular/http';
|
||||
import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
||||
import { LogService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
selector: 'about-page',
|
||||
@@ -27,31 +28,31 @@ export class AboutComponent implements OnInit {
|
||||
|
||||
data: ObjectDataTableAdapter;
|
||||
|
||||
constructor(private http: Http) {
|
||||
constructor(private http: Http,
|
||||
private logService: LogService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.http.get('/versions.json').subscribe(response => {
|
||||
var regexp = new RegExp("^(ng2-activiti|ng2-alfresco|alfresco-)", 'g');
|
||||
let regexp = new RegExp('^(ng2-activiti|ng2-alfresco|alfresco-)', 'g');
|
||||
|
||||
var alfrescoPackages = Object.keys(response.json().dependencies).filter(function (val) {
|
||||
console.log(val);
|
||||
let alfrescoPackages = Object.keys(response.json().dependencies).filter((val) => {
|
||||
this.logService.log(val);
|
||||
return regexp.test(val);
|
||||
});
|
||||
|
||||
let alfrescoPackagesTableRappresentation = [];
|
||||
alfrescoPackages.forEach((val)=> {
|
||||
console.log(response.json().dependencies[val]);
|
||||
alfrescoPackagesTableRappresentation.push({name:val,version:response.json().dependencies[val].version});
|
||||
let alfrescoPackagesTableRappresentation = [];
|
||||
alfrescoPackages.forEach((val) => {
|
||||
this.logService.log(response.json().dependencies[val]);
|
||||
alfrescoPackagesTableRappresentation.push({name: val, version: response.json().dependencies[val].version});
|
||||
});
|
||||
|
||||
console.log(alfrescoPackagesTableRappresentation);
|
||||
this.logService.log(alfrescoPackagesTableRappresentation);
|
||||
|
||||
this.data = new ObjectDataTableAdapter(alfrescoPackagesTableRappresentation, [
|
||||
{type: 'text', key: 'name', title: 'Name', sortable: true},
|
||||
{type: 'text', key: 'version', title: 'Version', sortable: true}
|
||||
]);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { Component, OnInit, Optional, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||
import { AuthService } from 'ng2-alfresco-core';
|
||||
import { AuthService, LogService } from 'ng2-alfresco-core';
|
||||
import {
|
||||
DocumentActionsService,
|
||||
DocumentList,
|
||||
@@ -49,8 +49,9 @@ export class FilesComponent implements OnInit {
|
||||
documentList: DocumentList;
|
||||
|
||||
constructor(private documentActions: DocumentActionsService,
|
||||
public authService: AuthService,
|
||||
private authService: AuthService,
|
||||
private formService: FormService,
|
||||
private logService: LogService,
|
||||
private router: Router,
|
||||
@Optional() private route: ActivatedRoute) {
|
||||
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
|
||||
@@ -109,10 +110,10 @@ export class FilesComponent implements OnInit {
|
||||
if (this.authService.isBpmLoggedIn()) {
|
||||
this.formService.getProcessDefinitions().subscribe(
|
||||
defs => this.setupBpmActions(defs || []),
|
||||
err => console.log(err)
|
||||
err => this.logService.error(err)
|
||||
);
|
||||
} else {
|
||||
console.log('You are not logged in');
|
||||
this.logService.warn('You are not logged in to BPM');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Validators } from '@angular/forms';
|
||||
import { StorageService } from 'ng2-alfresco-core';
|
||||
import { StorageService, LogService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
selector: 'login-demo',
|
||||
@@ -38,7 +38,9 @@ export class LoginDemoComponent implements OnInit {
|
||||
isECM: boolean = true;
|
||||
isBPM: boolean = false;
|
||||
|
||||
constructor(public router: Router, private storage: StorageService) {
|
||||
constructor(private router: Router,
|
||||
private storage: StorageService,
|
||||
private logService: LogService) {
|
||||
this.customValidation = {
|
||||
username: ['', Validators.compose([Validators.required, Validators.minLength(4)])],
|
||||
password: ['', Validators.required]
|
||||
@@ -75,7 +77,7 @@ export class LoginDemoComponent implements OnInit {
|
||||
}
|
||||
|
||||
onError($event) {
|
||||
console.log($event);
|
||||
this.logService.error($event);
|
||||
}
|
||||
|
||||
toggleECM() {
|
||||
@@ -92,7 +94,7 @@ export class LoginDemoComponent implements OnInit {
|
||||
this.disableCsrf = !this.disableCsrf;
|
||||
}
|
||||
|
||||
updateProvider(){
|
||||
updateProvider() {
|
||||
if (this.isBPM && this.isECM) {
|
||||
this.providers = 'ALL';
|
||||
return this.providers;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { SettingsService, StorageService } from 'ng2-alfresco-core';
|
||||
import { SettingsService, StorageService, LogService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
selector: 'alfresco-setting-demo',
|
||||
@@ -28,24 +28,31 @@ export class SettingComponent {
|
||||
ecmHost: string;
|
||||
bpmHost: string;
|
||||
|
||||
constructor(public settingsService: SettingsService,
|
||||
private storage: StorageService) {
|
||||
constructor(private settingsService: SettingsService,
|
||||
private storage: StorageService,
|
||||
private logService: LogService) {
|
||||
this.ecmHost = this.settingsService.ecmHost;
|
||||
this.bpmHost = this.settingsService.bpmHost;
|
||||
}
|
||||
|
||||
public onChangeECMHost(event: KeyboardEvent): void {
|
||||
console.log((<HTMLInputElement>event.target).value);
|
||||
this.ecmHost = (<HTMLInputElement>event.target).value;
|
||||
this.settingsService.ecmHost = this.ecmHost;
|
||||
this.storage.setItem(`ecmHost`, this.ecmHost);
|
||||
let value = (<HTMLInputElement>event.target).value.trim();
|
||||
if (value) {
|
||||
this.logService.info(`ECM host: ${value}`);
|
||||
this.ecmHost = value;
|
||||
this.settingsService.ecmHost = value;
|
||||
this.storage.setItem(`ecmHost`, value);
|
||||
}
|
||||
}
|
||||
|
||||
public onChangeBPMHost(event: KeyboardEvent): void {
|
||||
console.log((<HTMLInputElement>event.target).value);
|
||||
this.bpmHost = (<HTMLInputElement>event.target).value;
|
||||
this.settingsService.bpmHost = this.bpmHost;
|
||||
this.storage.setItem(`bpmHost`, this.bpmHost);
|
||||
let value = (<HTMLInputElement>event.target).value.trim();
|
||||
if (value) {
|
||||
this.logService.info(`BPM host: ${value}`);
|
||||
this.bpmHost = value;
|
||||
this.settingsService.bpmHost = value;
|
||||
this.storage.setItem(`bpmHost`, value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -16,42 +16,41 @@
|
||||
*/
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { LogService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
selector: 'alfresco-webscript-demo',
|
||||
template: `
|
||||
|
||||
<label for="script-path"><b>Insert a scriptPath</b></label><br>
|
||||
<input id="script-path" type="text" size="48" [(ngModel)]="scriptPath"><br>
|
||||
<label for="context-root"><b>Insert a contextRoot</b></label><br>
|
||||
<input id="context-root" type="text" size="48" [(ngModel)]="contextRoot"><br>
|
||||
<label for="service-path"><b>Insert a servicePath</b></label><br>
|
||||
<input id="service-path" type="text" size="48" [(ngModel)]="servicePath"><br>
|
||||
<alfresco-webscript-get [scriptPath]="scriptPath"
|
||||
[scriptArgs]="scriptArgs"
|
||||
[contextRoot]="contextRoot"
|
||||
[servicePath]="servicePath"
|
||||
[contentType]="'HTML'"
|
||||
(onSuccess)= "logData($event)"></alfresco-webscript-get>
|
||||
<label for="script-path"><b>Insert a scriptPath</b></label><br>
|
||||
<input id="script-path" type="text" size="48" [(ngModel)]="scriptPath"><br>
|
||||
<label for="context-root"><b>Insert a contextRoot</b></label><br>
|
||||
<input id="context-root" type="text" size="48" [(ngModel)]="contextRoot"><br>
|
||||
<label for="service-path"><b>Insert a servicePath</b></label><br>
|
||||
<input id="service-path" type="text" size="48" [(ngModel)]="servicePath"><br>
|
||||
<alfresco-webscript-get
|
||||
[scriptPath]="scriptPath"
|
||||
[scriptArgs]="scriptArgs"
|
||||
[contextRoot]="contextRoot"
|
||||
[servicePath]="servicePath"
|
||||
[contentType]="'HTML'"
|
||||
(onSuccess)= "logData($event)">
|
||||
</alfresco-webscript-get>
|
||||
`
|
||||
})
|
||||
export class WebscriptComponent {
|
||||
|
||||
currentPath: string = '/';
|
||||
|
||||
authenticated: boolean;
|
||||
|
||||
host: string = 'http://127.0.0.1:8080';
|
||||
|
||||
scriptPath: string = 'sample/folder/Company%20Home';
|
||||
|
||||
contextRoot: string = 'alfresco';
|
||||
|
||||
servicePath: string = 'service';
|
||||
|
||||
scriptArgs: string = '';
|
||||
|
||||
constructor(private logService: LogService) {
|
||||
}
|
||||
|
||||
logData(data) {
|
||||
console.log(data);
|
||||
this.logService.log(data);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user