mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
Migrate from window.console to LogService
This commit is contained in:
parent
2d98a04f87
commit
d42f41ec00
@ -17,13 +17,7 @@
|
|||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { AlfrescoTranslateService, AuthService, SettingsService, StorageService, LogService } from 'ng2-alfresco-core';
|
||||||
import {
|
|
||||||
AlfrescoTranslationService,
|
|
||||||
AuthService,
|
|
||||||
SettingsService,
|
|
||||||
StorageService
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
|
|
||||||
declare var document: any;
|
declare var document: any;
|
||||||
|
|
||||||
@ -38,22 +32,23 @@ export class AppComponent {
|
|||||||
ecmHost: string = 'http://' + window.location.hostname + ':8080';
|
ecmHost: string = 'http://' + window.location.hostname + ':8080';
|
||||||
bpmHost: string = 'http://' + window.location.hostname + ':9999';
|
bpmHost: string = 'http://' + window.location.hostname + ':9999';
|
||||||
|
|
||||||
constructor(public authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
public router: Router,
|
private router: Router,
|
||||||
public settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private translate: AlfrescoTranslationService,
|
private translateService: AlfrescoTranslateService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService,
|
||||||
|
private logService: LogService) {
|
||||||
this.setEcmHost();
|
this.setEcmHost();
|
||||||
this.setBpmHost();
|
this.setBpmHost();
|
||||||
this.setProvider();
|
this.setProvider();
|
||||||
|
|
||||||
if (translate) {
|
if (translateService) {
|
||||||
if (process.env.ENV === 'production') {
|
if (process.env.ENV === 'production') {
|
||||||
translate.addTranslationFolder('custom', 'i18n/custom-translation');
|
translateService.addTranslationFolder('custom', 'i18n/custom-translation');
|
||||||
translate.addTranslationFolder('ng2-alfresco-login', 'i18n/custom-translation/alfresco-login');
|
translateService.addTranslationFolder('ng2-alfresco-login', 'i18n/custom-translation/alfresco-login');
|
||||||
} else {
|
} else {
|
||||||
translate.addTranslationFolder('custom', 'custom-translation');
|
translateService.addTranslationFolder('custom', 'custom-translation');
|
||||||
translate.addTranslationFolder('ng2-alfresco-login', 'custom-translation/alfresco-login');
|
translateService.addTranslationFolder('ng2-alfresco-login', 'custom-translation/alfresco-login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,7 +79,7 @@ export class AppComponent {
|
|||||||
if (error && error.response && error.response.status === 401) {
|
if (error && error.response && error.response.status === 401) {
|
||||||
this.navigateToLogin();
|
this.navigateToLogin();
|
||||||
} else {
|
} else {
|
||||||
console.error('An unknown error occurred while logging out', error);
|
this.logService.error('An unknown error occurred while logging out', error);
|
||||||
this.navigateToLogin();
|
this.navigateToLogin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,7 +102,7 @@ export class AppComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
changeLanguage(lang: string) {
|
changeLanguage(lang: string) {
|
||||||
this.translate.use(lang);
|
this.translateService.use(lang);
|
||||||
this.hideDrawer();
|
this.hideDrawer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Http } from '@angular/http';
|
import { Http } from '@angular/http';
|
||||||
import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
||||||
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'about-page',
|
selector: 'about-page',
|
||||||
@ -27,31 +28,31 @@ export class AboutComponent implements OnInit {
|
|||||||
|
|
||||||
data: ObjectDataTableAdapter;
|
data: ObjectDataTableAdapter;
|
||||||
|
|
||||||
constructor(private http: Http) {
|
constructor(private http: Http,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.http.get('/versions.json').subscribe(response => {
|
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) {
|
let alfrescoPackages = Object.keys(response.json().dependencies).filter((val) => {
|
||||||
console.log(val);
|
this.logService.log(val);
|
||||||
return regexp.test(val);
|
return regexp.test(val);
|
||||||
});
|
});
|
||||||
|
|
||||||
let alfrescoPackagesTableRappresentation = [];
|
let alfrescoPackagesTableRappresentation = [];
|
||||||
alfrescoPackages.forEach((val)=> {
|
alfrescoPackages.forEach((val) => {
|
||||||
console.log(response.json().dependencies[val]);
|
this.logService.log(response.json().dependencies[val]);
|
||||||
alfrescoPackagesTableRappresentation.push({name:val,version:response.json().dependencies[val].version});
|
alfrescoPackagesTableRappresentation.push({name: val, version: response.json().dependencies[val].version});
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(alfrescoPackagesTableRappresentation);
|
this.logService.log(alfrescoPackagesTableRappresentation);
|
||||||
|
|
||||||
this.data = new ObjectDataTableAdapter(alfrescoPackagesTableRappresentation, [
|
this.data = new ObjectDataTableAdapter(alfrescoPackagesTableRappresentation, [
|
||||||
{type: 'text', key: 'name', title: 'Name', sortable: true},
|
{type: 'text', key: 'name', title: 'Name', sortable: true},
|
||||||
{type: 'text', key: 'version', title: 'Version', sortable: true}
|
{type: 'text', key: 'version', title: 'Version', sortable: true}
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Component, OnInit, Optional, ViewChild } from '@angular/core';
|
import { Component, OnInit, Optional, ViewChild } from '@angular/core';
|
||||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||||
import { AuthService } from 'ng2-alfresco-core';
|
import { AuthService, LogService } from 'ng2-alfresco-core';
|
||||||
import {
|
import {
|
||||||
DocumentActionsService,
|
DocumentActionsService,
|
||||||
DocumentList,
|
DocumentList,
|
||||||
@ -49,8 +49,9 @@ export class FilesComponent implements OnInit {
|
|||||||
documentList: DocumentList;
|
documentList: DocumentList;
|
||||||
|
|
||||||
constructor(private documentActions: DocumentActionsService,
|
constructor(private documentActions: DocumentActionsService,
|
||||||
public authService: AuthService,
|
private authService: AuthService,
|
||||||
private formService: FormService,
|
private formService: FormService,
|
||||||
|
private logService: LogService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
@Optional() private route: ActivatedRoute) {
|
@Optional() private route: ActivatedRoute) {
|
||||||
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
|
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
|
||||||
@ -109,10 +110,10 @@ export class FilesComponent implements OnInit {
|
|||||||
if (this.authService.isBpmLoggedIn()) {
|
if (this.authService.isBpmLoggedIn()) {
|
||||||
this.formService.getProcessDefinitions().subscribe(
|
this.formService.getProcessDefinitions().subscribe(
|
||||||
defs => this.setupBpmActions(defs || []),
|
defs => this.setupBpmActions(defs || []),
|
||||||
err => console.log(err)
|
err => this.logService.error(err)
|
||||||
);
|
);
|
||||||
} else {
|
} 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 { Component, ViewChild, OnInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Validators } from '@angular/forms';
|
import { Validators } from '@angular/forms';
|
||||||
import { StorageService } from 'ng2-alfresco-core';
|
import { StorageService, LogService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'login-demo',
|
selector: 'login-demo',
|
||||||
@ -38,7 +38,9 @@ export class LoginDemoComponent implements OnInit {
|
|||||||
isECM: boolean = true;
|
isECM: boolean = true;
|
||||||
isBPM: boolean = false;
|
isBPM: boolean = false;
|
||||||
|
|
||||||
constructor(public router: Router, private storage: StorageService) {
|
constructor(private router: Router,
|
||||||
|
private storage: StorageService,
|
||||||
|
private logService: LogService) {
|
||||||
this.customValidation = {
|
this.customValidation = {
|
||||||
username: ['', Validators.compose([Validators.required, Validators.minLength(4)])],
|
username: ['', Validators.compose([Validators.required, Validators.minLength(4)])],
|
||||||
password: ['', Validators.required]
|
password: ['', Validators.required]
|
||||||
@ -75,7 +77,7 @@ export class LoginDemoComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onError($event) {
|
onError($event) {
|
||||||
console.log($event);
|
this.logService.error($event);
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleECM() {
|
toggleECM() {
|
||||||
@ -92,7 +94,7 @@ export class LoginDemoComponent implements OnInit {
|
|||||||
this.disableCsrf = !this.disableCsrf;
|
this.disableCsrf = !this.disableCsrf;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateProvider(){
|
updateProvider() {
|
||||||
if (this.isBPM && this.isECM) {
|
if (this.isBPM && this.isECM) {
|
||||||
this.providers = 'ALL';
|
this.providers = 'ALL';
|
||||||
return this.providers;
|
return this.providers;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { SettingsService, StorageService } from 'ng2-alfresco-core';
|
import { SettingsService, StorageService, LogService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'alfresco-setting-demo',
|
selector: 'alfresco-setting-demo',
|
||||||
@ -28,24 +28,31 @@ export class SettingComponent {
|
|||||||
ecmHost: string;
|
ecmHost: string;
|
||||||
bpmHost: string;
|
bpmHost: string;
|
||||||
|
|
||||||
constructor(public settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService,
|
||||||
|
private logService: LogService) {
|
||||||
this.ecmHost = this.settingsService.ecmHost;
|
this.ecmHost = this.settingsService.ecmHost;
|
||||||
this.bpmHost = this.settingsService.bpmHost;
|
this.bpmHost = this.settingsService.bpmHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public onChangeECMHost(event: KeyboardEvent): void {
|
public onChangeECMHost(event: KeyboardEvent): void {
|
||||||
console.log((<HTMLInputElement>event.target).value);
|
let value = (<HTMLInputElement>event.target).value.trim();
|
||||||
this.ecmHost = (<HTMLInputElement>event.target).value;
|
if (value) {
|
||||||
this.settingsService.ecmHost = this.ecmHost;
|
this.logService.info(`ECM host: ${value}`);
|
||||||
this.storage.setItem(`ecmHost`, this.ecmHost);
|
this.ecmHost = value;
|
||||||
|
this.settingsService.ecmHost = value;
|
||||||
|
this.storage.setItem(`ecmHost`, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public onChangeBPMHost(event: KeyboardEvent): void {
|
public onChangeBPMHost(event: KeyboardEvent): void {
|
||||||
console.log((<HTMLInputElement>event.target).value);
|
let value = (<HTMLInputElement>event.target).value.trim();
|
||||||
this.bpmHost = (<HTMLInputElement>event.target).value;
|
if (value) {
|
||||||
this.settingsService.bpmHost = this.bpmHost;
|
this.logService.info(`BPM host: ${value}`);
|
||||||
this.storage.setItem(`bpmHost`, this.bpmHost);
|
this.bpmHost = value;
|
||||||
|
this.settingsService.bpmHost = value;
|
||||||
|
this.storage.setItem(`bpmHost`, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,42 +16,41 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'alfresco-webscript-demo',
|
selector: 'alfresco-webscript-demo',
|
||||||
template: `
|
template: `
|
||||||
|
<label for="script-path"><b>Insert a scriptPath</b></label><br>
|
||||||
<label for="script-path"><b>Insert a scriptPath</b></label><br>
|
<input id="script-path" type="text" size="48" [(ngModel)]="scriptPath"><br>
|
||||||
<input id="script-path" type="text" size="48" [(ngModel)]="scriptPath"><br>
|
<label for="context-root"><b>Insert a contextRoot</b></label><br>
|
||||||
<label for="context-root"><b>Insert a contextRoot</b></label><br>
|
<input id="context-root" type="text" size="48" [(ngModel)]="contextRoot"><br>
|
||||||
<input id="context-root" type="text" size="48" [(ngModel)]="contextRoot"><br>
|
<label for="service-path"><b>Insert a servicePath</b></label><br>
|
||||||
<label for="service-path"><b>Insert a servicePath</b></label><br>
|
<input id="service-path" type="text" size="48" [(ngModel)]="servicePath"><br>
|
||||||
<input id="service-path" type="text" size="48" [(ngModel)]="servicePath"><br>
|
<alfresco-webscript-get
|
||||||
<alfresco-webscript-get [scriptPath]="scriptPath"
|
[scriptPath]="scriptPath"
|
||||||
[scriptArgs]="scriptArgs"
|
[scriptArgs]="scriptArgs"
|
||||||
[contextRoot]="contextRoot"
|
[contextRoot]="contextRoot"
|
||||||
[servicePath]="servicePath"
|
[servicePath]="servicePath"
|
||||||
[contentType]="'HTML'"
|
[contentType]="'HTML'"
|
||||||
(onSuccess)= "logData($event)"></alfresco-webscript-get>
|
(onSuccess)= "logData($event)">
|
||||||
|
</alfresco-webscript-get>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class WebscriptComponent {
|
export class WebscriptComponent {
|
||||||
|
|
||||||
currentPath: string = '/';
|
currentPath: string = '/';
|
||||||
|
|
||||||
authenticated: boolean;
|
authenticated: boolean;
|
||||||
|
|
||||||
host: string = 'http://127.0.0.1:8080';
|
host: string = 'http://127.0.0.1:8080';
|
||||||
|
|
||||||
scriptPath: string = 'sample/folder/Company%20Home';
|
scriptPath: string = 'sample/folder/Company%20Home';
|
||||||
|
|
||||||
contextRoot: string = 'alfresco';
|
contextRoot: string = 'alfresco';
|
||||||
|
|
||||||
servicePath: string = 'service';
|
servicePath: string = 'service';
|
||||||
|
|
||||||
scriptArgs: string = '';
|
scriptArgs: string = '';
|
||||||
|
|
||||||
|
constructor(private logService: LogService) {
|
||||||
|
}
|
||||||
|
|
||||||
logData(data) {
|
logData(data) {
|
||||||
console.log(data);
|
this.logService.log(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,51 +18,49 @@
|
|||||||
import { NgModule, Component, OnInit } from '@angular/core';
|
import { NgModule, Component, OnInit } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { CoreModule, SettingsService, AuthService, StorageService } from 'ng2-alfresco-core';
|
import { CoreModule, SettingsService, AuthService, StorageService, LogService } from 'ng2-alfresco-core';
|
||||||
import { AnalyticsModule } from 'ng2-activiti-analytics';
|
import { AnalyticsModule } from 'ng2-activiti-analytics';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'alfresco-app-demo',
|
selector: 'alfresco-app-demo',
|
||||||
template: `
|
template: `
|
||||||
<label for="ticket"><b>Insert a valid ticket:</b></label><br>
|
<label for="ticket"><b>Insert a valid ticket:</b></label><br>
|
||||||
<input id="ticket" type="text" size="48" (change)="updateTicket()" [(ngModel)]="ticket"><br>
|
<input id="ticket" type="text" size="48" (change)="updateTicket()" [(ngModel)]="ticket"><br>
|
||||||
<label for="host"><b>Insert the ip of your Activiti instance:</b></label><br>
|
<label for="host"><b>Insert the ip of your Activiti instance:</b></label><br>
|
||||||
<input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="host"><br><br>
|
<input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="host"><br><br>
|
||||||
<div *ngIf="!authenticated" style="color:#FF2323">
|
<div *ngIf="!authenticated" style="color:#FF2323">
|
||||||
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid ticket to perform
|
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid ticket to perform
|
||||||
operations.
|
operations.
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<label for="appId"><b>Insert the appId:</b></label><br>
|
<label for="appId"><b>Insert the appId:</b></label><br>
|
||||||
<input id="appId" size="10" type="text" [(ngModel)]="appId">
|
<input id="appId" size="10" type="text" [(ngModel)]="appId">
|
||||||
<div class="mdl-grid">
|
<div class="mdl-grid">
|
||||||
<div class="mdl-cell mdl-cell--4-col task-column mdl-shadow--2dp">
|
<div class="mdl-cell mdl-cell--4-col task-column mdl-shadow--2dp">
|
||||||
<analytics-report-list (reportClick)="onReportClick($event)"></analytics-report-list>
|
<analytics-report-list (reportClick)="onReportClick($event)"></analytics-report-list>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-cell mdl-cell--8-col task-column mdl-shadow--2dp">
|
<div class="mdl-cell mdl-cell--8-col task-column mdl-shadow--2dp">
|
||||||
<activiti-analytics [appId]="appId" *ngIf="report" [reportId]="report.id"></activiti-analytics>
|
<activiti-analytics [appId]="appId" *ngIf="report" [reportId]="report.id"></activiti-analytics>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>`
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
export class AnalyticsDemoComponent implements OnInit {
|
export class AnalyticsDemoComponent implements OnInit {
|
||||||
|
|
||||||
appId: number;
|
appId: number;
|
||||||
|
|
||||||
report: any;
|
report: any;
|
||||||
|
|
||||||
authenticated: boolean;
|
authenticated: boolean;
|
||||||
|
|
||||||
host: string = 'http://localhost:9999';
|
host: string = 'http://localhost:9999';
|
||||||
|
|
||||||
ticket: string;
|
ticket: string;
|
||||||
|
|
||||||
constructor(private authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService,
|
||||||
|
private logService: LogService) {
|
||||||
settingsService.bpmHost = this.host;
|
settingsService.bpmHost = this.host;
|
||||||
settingsService.setProviders('BPM');
|
settingsService.setProviders('BPM');
|
||||||
|
|
||||||
@ -91,12 +89,12 @@ export class AnalyticsDemoComponent implements OnInit {
|
|||||||
login() {
|
login() {
|
||||||
this.authService.login('admin', 'admin').subscribe(
|
this.authService.login('admin', 'admin').subscribe(
|
||||||
ticket => {
|
ticket => {
|
||||||
console.log(ticket);
|
this.logService.log(ticket);
|
||||||
this.ticket = this.authService.getTicketBpm();
|
this.ticket = this.authService.getTicketBpm();
|
||||||
this.authenticated = true;
|
this.authenticated = true;
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log(error);
|
this.logService.error(error);
|
||||||
this.authenticated = false;
|
this.authenticated = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||||
import { Observer, Observable } from 'rxjs/Rx';
|
import { Observer, Observable } from 'rxjs/Rx';
|
||||||
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
import { AnalyticsService } from '../services/analytics.service';
|
import { AnalyticsService } from '../services/analytics.service';
|
||||||
import { ReportParametersModel } from '../models/report.model';
|
import { ReportParametersModel } from '../models/report.model';
|
||||||
|
|
||||||
@ -44,8 +45,8 @@ export class AnalyticsReportListComponent implements OnInit {
|
|||||||
|
|
||||||
reports: ReportParametersModel[] = [];
|
reports: ReportParametersModel[] = [];
|
||||||
|
|
||||||
constructor(private analyticsService: AnalyticsService) {
|
constructor(private analyticsService: AnalyticsService,
|
||||||
|
private logService: LogService) {
|
||||||
this.report$ = new Observable<ReportParametersModel>(observer => this.reportObserver = observer).share();
|
this.report$ = new Observable<ReportParametersModel>(observer => this.reportObserver = observer).share();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ export class AnalyticsReportListComponent implements OnInit {
|
|||||||
},
|
},
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
this.onError.emit(err);
|
this.onError.emit(err);
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, EventEmitter, OnInit, OnChanges, Input, Output, SimpleChanges, OnDestroy, AfterViewChecked } from '@angular/core';
|
import { Component, EventEmitter, OnInit, OnChanges, Input, Output, SimpleChanges, OnDestroy, AfterViewChecked } from '@angular/core';
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
|
||||||
import { AnalyticsService } from '../services/analytics.service';
|
|
||||||
import { ReportParametersModel, ReportQuery, ParameterValueModel, ReportParameterDetailsModel } from '../models/report.model';
|
|
||||||
import { FormGroup, FormBuilder, FormControl } from '@angular/forms';
|
import { FormGroup, FormBuilder, FormControl } from '@angular/forms';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
|
import { AnalyticsService } from '../services/analytics.service';
|
||||||
|
import { ReportParametersModel, ReportQuery, ParameterValueModel, ReportParameterDetailsModel } from '../models/report.model';
|
||||||
|
|
||||||
declare var componentHandler;
|
declare var componentHandler;
|
||||||
|
|
||||||
@ -72,7 +72,8 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On
|
|||||||
|
|
||||||
constructor(private translateService: AlfrescoTranslateService,
|
constructor(private translateService: AlfrescoTranslateService,
|
||||||
private analyticsService: AnalyticsService,
|
private analyticsService: AnalyticsService,
|
||||||
private formBuilder: FormBuilder ) {
|
private formBuilder: FormBuilder,
|
||||||
|
private logService: LogService) {
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
translateService.addTranslationFolder('ng2-activiti-analytics', 'node_modules/ng2-activiti-analytics/src');
|
translateService.addTranslationFolder('ng2-activiti-analytics', 'node_modules/ng2-activiti-analytics/src');
|
||||||
}
|
}
|
||||||
@ -148,7 +149,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
this.onError.emit(err);
|
this.onError.emit(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -162,7 +163,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On
|
|||||||
this.onSuccessParamOpt.emit(opts);
|
this.onSuccessParamOpt.emit(opts);
|
||||||
},
|
},
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
this.onError.emit(err);
|
this.onError.emit(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -233,7 +234,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On
|
|||||||
this.onEdit.emit(this.reportParameters.name);
|
this.onEdit.emit(this.reportParameters.name);
|
||||||
},
|
},
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
this.onError.emit(err);
|
this.onError.emit(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, EventEmitter, OnChanges, Input, Output, SimpleChanges } from '@angular/core';
|
import { Component, EventEmitter, OnChanges, Input, Output, SimpleChanges } from '@angular/core';
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { AnalyticsService } from '../services/analytics.service';
|
import { AnalyticsService } from '../services/analytics.service';
|
||||||
import { ReportQuery } from '../models/report.model';
|
import { ReportQuery } from '../models/report.model';
|
||||||
import { Chart } from '../models/chart.model';
|
import { Chart } from '../models/chart.model';
|
||||||
@ -71,8 +71,9 @@ export class AnalyticsComponent implements OnChanges {
|
|||||||
};
|
};
|
||||||
|
|
||||||
constructor(private translateService: AlfrescoTranslateService,
|
constructor(private translateService: AlfrescoTranslateService,
|
||||||
private analyticsService: AnalyticsService) {
|
private analyticsService: AnalyticsService,
|
||||||
console.log('AnalyticsComponent');
|
private logService: LogService) {
|
||||||
|
logService.info('AnalyticsComponent');
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
translateService.addTranslationFolder('ng2-activiti-analytics', 'node_modules/ng2-activiti-analytics/src');
|
translateService.addTranslationFolder('ng2-activiti-analytics', 'node_modules/ng2-activiti-analytics/src');
|
||||||
}
|
}
|
||||||
@ -91,7 +92,7 @@ export class AnalyticsComponent implements OnChanges {
|
|||||||
},
|
},
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
this.onError.emit(err);
|
this.onError.emit(err);
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,15 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { Response } from '@angular/http';
|
import { Response } from '@angular/http';
|
||||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
import { AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||||
import { ReportParametersModel, ParameterValueModel } from '../models/report.model';
|
import { ReportParametersModel, ParameterValueModel } from '../models/report.model';
|
||||||
import { Chart, PieChart, TableChart, BarChart, HeatMapChart, MultiBarChart, DetailsTableChart } from '../models/chart.model';
|
import { Chart, PieChart, TableChart, BarChart, HeatMapChart, MultiBarChart, DetailsTableChart } from '../models/chart.model';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AnalyticsService {
|
export class AnalyticsService {
|
||||||
|
|
||||||
constructor(public apiService: AlfrescoApiService) {
|
constructor(private apiService: AlfrescoApiService,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -170,21 +171,21 @@ export class AnalyticsService {
|
|||||||
}).catch(this.handleError);
|
}).catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
public createDefaultReports(): Observable<any> {
|
createDefaultReports(): Observable<any> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.createDefaultReports())
|
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.createDefaultReports())
|
||||||
.map(this.toJson)
|
.map(this.toJson)
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateReport(reportId: number, name: string): Observable<any> {
|
updateReport(reportId: number, name: string): Observable<any> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.updateReport(reportId, name))
|
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.updateReport(reportId, name))
|
||||||
.map((res: any) => {
|
.map((res: any) => {
|
||||||
console.log('upload');
|
this.logService.info('upload');
|
||||||
}).catch(this.handleError);
|
}).catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleError(error: Response) {
|
private handleError(error: Response) {
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
return Observable.throw(error.json().error || 'Server error');
|
return Observable.throw(error.json().error || 'Server error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,40 +19,39 @@ import { NgModule, Component } from '@angular/core';
|
|||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { CoreModule, SettingsService, AuthService, StorageService } from 'ng2-alfresco-core';
|
import { CoreModule, SettingsService, AuthService, StorageService, LogService } from 'ng2-alfresco-core';
|
||||||
import { DiagramsModule } from 'ng2-activiti-diagrams';
|
import { DiagramsModule } from 'ng2-activiti-diagrams';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'alfresco-app-demo',
|
selector: 'alfresco-app-demo',
|
||||||
template: `
|
template: `
|
||||||
<label for="ticket"><b>Insert a valid ticket:</b></label><br>
|
<label for="ticket"><b>Insert a valid ticket:</b></label><br>
|
||||||
<input id="ticket" type="text" size="48" (change)="updateTicket()" [(ngModel)]="ticket"><br>
|
<input id="ticket" type="text" size="48" (change)="updateTicket()" [(ngModel)]="ticket"><br>
|
||||||
<label for="host"><b>Insert the ip of your Activiti instance:</b></label><br>
|
<label for="host"><b>Insert the ip of your Activiti instance:</b></label><br>
|
||||||
<input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="host"><br><br>
|
<input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="host"><br><br>
|
||||||
<div *ngIf="!authenticated" style="color:#FF2323">
|
<div *ngIf="!authenticated" style="color:#FF2323">
|
||||||
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid ticket to perform
|
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid ticket to perform
|
||||||
operations.
|
operations.
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<label for="processDefinitionId"><b>Insert the ProcessDefinitionId:</b></label><br>
|
<label for="processDefinitionId"><b>Insert the ProcessDefinitionId:</b></label><br>
|
||||||
<input id="processDefinitionId" size="70" type="text" [(ngModel)]="processDefinitionId">
|
<input id="processDefinitionId" size="70" type="text" [(ngModel)]="processDefinitionId">
|
||||||
<activiti-diagram [processDefinitionId]="processDefinitionId"></activiti-diagram>`
|
<activiti-diagram [processDefinitionId]="processDefinitionId"></activiti-diagram>
|
||||||
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
export class DiagramDemoComponent {
|
export class DiagramDemoComponent {
|
||||||
|
|
||||||
processDefinitionId: string = 'ThirdProcess:1:15053';
|
processDefinitionId: string = 'ThirdProcess:1:15053';
|
||||||
|
|
||||||
authenticated: boolean;
|
authenticated: boolean;
|
||||||
|
|
||||||
host: string = 'http://localhost:9999';
|
host: string = 'http://localhost:9999';
|
||||||
|
|
||||||
ticket: string;
|
ticket: string;
|
||||||
|
|
||||||
constructor(private authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService,
|
||||||
|
private logService: LogService) {
|
||||||
settingsService.bpmHost = this.host;
|
settingsService.bpmHost = this.host;
|
||||||
settingsService.setProviders('BPM');
|
settingsService.setProviders('BPM');
|
||||||
|
|
||||||
@ -77,12 +76,12 @@ export class DiagramDemoComponent {
|
|||||||
login() {
|
login() {
|
||||||
this.authService.login('admin', 'admin').subscribe(
|
this.authService.login('admin', 'admin').subscribe(
|
||||||
ticket => {
|
ticket => {
|
||||||
console.log(ticket);
|
this.logService.info(`Logged in with ticket ${ticket}`);
|
||||||
this.ticket = this.authService.getTicketBpm();
|
this.ticket = this.authService.getTicketBpm();
|
||||||
this.authenticated = true;
|
this.authenticated = true;
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log(error);
|
this.logService.error(error);
|
||||||
this.authenticated = false;
|
this.authenticated = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, ElementRef, Input, Output, EventEmitter, SimpleChanges } from '@angular/core';
|
import { Component, ElementRef, Input, Output, EventEmitter, SimpleChanges } from '@angular/core';
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { DiagramsService } from '../services/diagrams.service';
|
import { DiagramsService } from '../services/diagrams.service';
|
||||||
import { DiagramColorService } from '../services/diagram-color.service';
|
import { DiagramColorService } from '../services/diagram-color.service';
|
||||||
import { RaphaelService } from './raphael/raphael.service';
|
import { RaphaelService } from './raphael/raphael.service';
|
||||||
@ -57,17 +57,16 @@ export class DiagramComponent {
|
|||||||
PADDING_HEIGHT: number = 60;
|
PADDING_HEIGHT: number = 60;
|
||||||
|
|
||||||
private diagram: DiagramModel;
|
private diagram: DiagramModel;
|
||||||
private elementRef: ElementRef;
|
|
||||||
|
|
||||||
constructor(elementRef: ElementRef,
|
constructor(private elementRef: ElementRef,
|
||||||
private translateService: AlfrescoTranslateService,
|
private translateService: AlfrescoTranslateService,
|
||||||
private diagramColorService: DiagramColorService,
|
private diagramColorService: DiagramColorService,
|
||||||
private raphaelService: RaphaelService,
|
private raphaelService: RaphaelService,
|
||||||
private diagramsService: DiagramsService) {
|
private diagramsService: DiagramsService,
|
||||||
|
private logService: LogService) {
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
translateService.addTranslationFolder('ng2-activiti-diagrams', 'node_modules/ng2-activiti-diagrams/src');
|
translateService.addTranslationFolder('ng2-activiti-diagrams', 'node_modules/ng2-activiti-diagrams/src');
|
||||||
}
|
}
|
||||||
this.elementRef = elementRef;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
@ -86,7 +85,7 @@ export class DiagramComponent {
|
|||||||
},
|
},
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
this.onError.emit(err);
|
this.onError.emit(err);
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Directive, OnInit, ElementRef, Input, Output, EventEmitter } from '@angular/core';
|
import { Directive, OnInit, ElementRef, Input, Output, EventEmitter } from '@angular/core';
|
||||||
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
import { Point } from './models/point';
|
import { Point } from './models/point';
|
||||||
import { RaphaelBase } from './raphael-base';
|
import { RaphaelBase } from './raphael-base';
|
||||||
import { RaphaelService } from './raphael.service';
|
import { RaphaelService } from './raphael.service';
|
||||||
@ -43,19 +44,20 @@ export class RaphaelMultilineTextDirective extends RaphaelBase implements OnInit
|
|||||||
TEXT_PADDING = 3;
|
TEXT_PADDING = 3;
|
||||||
|
|
||||||
constructor(public elementRef: ElementRef,
|
constructor(public elementRef: ElementRef,
|
||||||
raphaelService: RaphaelService) {
|
raphaelService: RaphaelService,
|
||||||
|
private logService: LogService) {
|
||||||
super(elementRef, raphaelService);
|
super(elementRef, raphaelService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
console.log(this.elementRef);
|
this.logService.log(this.elementRef);
|
||||||
if (this.text === null || this.text === undefined) {
|
if (this.text === null || this.text === undefined) {
|
||||||
this.text = '';
|
this.text = '';
|
||||||
}
|
}
|
||||||
this.draw(this.position, this.text);
|
this.draw(this.position, this.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public draw(position: Point, text: string) {
|
draw(position: Point, text: string) {
|
||||||
let textPaper = this.paper.text(position.x + this.TEXT_PADDING, position.y + this.TEXT_PADDING, text).attr({
|
let textPaper = this.paper.text(position.x + this.TEXT_PADDING, position.y + this.TEXT_PADDING, text).attr({
|
||||||
'text-anchor': 'middle',
|
'text-anchor': 'middle',
|
||||||
'font-family': 'Arial',
|
'font-family': 'Arial',
|
||||||
|
@ -16,16 +16,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AuthService, SettingsService } from 'ng2-alfresco-core';
|
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { Response, Http, Headers, RequestOptions } from '@angular/http';
|
import { Response, Http, Headers, RequestOptions } from '@angular/http';
|
||||||
|
import { AuthService, SettingsService, LogService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DiagramsService {
|
export class DiagramsService {
|
||||||
|
|
||||||
constructor(private authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
private http: Http,
|
private http: Http,
|
||||||
private settingsService: SettingsService) {
|
private settingsService: SettingsService,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
getProcessDefinitionModel(processDefinitionId: string): Observable<any> {
|
getProcessDefinitionModel(processDefinitionId: string): Observable<any> {
|
||||||
@ -53,7 +54,7 @@ export class DiagramsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleError(error: Response) {
|
private handleError(error: Response) {
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
return Observable.throw(error.json().error || 'Server error');
|
return Observable.throw(error.json().error || 'Server error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,40 +18,39 @@
|
|||||||
import { NgModule, Component, OnInit } from '@angular/core';
|
import { NgModule, Component, OnInit } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { CoreModule, SettingsService, AuthService, StorageService } from 'ng2-alfresco-core';
|
import { CoreModule, SettingsService, AuthService, StorageService, LogService } from 'ng2-alfresco-core';
|
||||||
import { ActivitiFormModule } from 'ng2-activiti-form';
|
import { ActivitiFormModule } from 'ng2-activiti-form';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'alfresco-app-demo',
|
selector: 'alfresco-app-demo',
|
||||||
template: `
|
template: `
|
||||||
<label for="ticket"><b>Insert a valid ticket:</b></label><br>
|
<label for="ticket"><b>Insert a valid ticket:</b></label><br>
|
||||||
<input id="ticket" type="text" size="48" (change)="updateTicket()" [(ngModel)]="ticket"><br>
|
<input id="ticket" type="text" size="48" (change)="updateTicket()" [(ngModel)]="ticket"><br>
|
||||||
<label for="host"><b>Insert the ip of your Activiti instance:</b></label><br>
|
<label for="host"><b>Insert the ip of your Activiti instance:</b></label><br>
|
||||||
<input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="host"><br><br>
|
<input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="host"><br><br>
|
||||||
<div *ngIf="!authenticated" style="color:#FF2323">
|
<div *ngIf="!authenticated" style="color:#FF2323">
|
||||||
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid ticket to perform
|
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid ticket to perform
|
||||||
operations.
|
operations.
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<label for="taskId"><b>Insert the taskId:</b></label><br>
|
<label for="taskId"><b>Insert the taskId:</b></label><br>
|
||||||
<input id="taskId" size="10" type="text" [(ngModel)]="taskId">
|
<input id="taskId" size="10" type="text" [(ngModel)]="taskId">
|
||||||
<activiti-form [taskId]="taskId"></activiti-form>`
|
<activiti-form [taskId]="taskId"></activiti-form>
|
||||||
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
export class FormDemoComponent implements OnInit {
|
export class FormDemoComponent implements OnInit {
|
||||||
|
|
||||||
taskId: number;
|
taskId: number;
|
||||||
|
|
||||||
authenticated: boolean;
|
authenticated: boolean;
|
||||||
|
|
||||||
host: string = 'http://localhost:9999';
|
host: string = 'http://localhost:9999';
|
||||||
|
|
||||||
ticket: string;
|
ticket: string;
|
||||||
|
|
||||||
constructor(private authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService,
|
||||||
|
private logService: LogService) {
|
||||||
settingsService.bpmHost = this.host;
|
settingsService.bpmHost = this.host;
|
||||||
settingsService.setProviders('BPM');
|
settingsService.setProviders('BPM');
|
||||||
|
|
||||||
@ -76,12 +75,12 @@ export class FormDemoComponent implements OnInit {
|
|||||||
login() {
|
login() {
|
||||||
this.authService.login('admin', 'admin').subscribe(
|
this.authService.login('admin', 'admin').subscribe(
|
||||||
ticket => {
|
ticket => {
|
||||||
console.log(ticket);
|
this.logService.info(`Logged in with ticket ${ticket}`);
|
||||||
this.ticket = this.authService.getTicketBpm();
|
this.ticket = this.authService.getTicketBpm();
|
||||||
this.authenticated = true;
|
this.authenticated = true;
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log(error);
|
this.logService.error(error);
|
||||||
this.authenticated = false;
|
this.authenticated = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { SimpleChange } from '@angular/core';
|
import { SimpleChange } from '@angular/core';
|
||||||
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
import { ActivitiForm } from './activiti-form.component';
|
import { ActivitiForm } from './activiti-form.component';
|
||||||
import { FormModel, FormOutcomeModel, FormFieldModel, FormOutcomeEvent, FormFieldTypes } from './widgets/index';
|
import { FormModel, FormOutcomeModel, FormFieldModel, FormOutcomeEvent, FormFieldTypes } from './widgets/index';
|
||||||
import { FormService } from './../services/form.service';
|
import { FormService } from './../services/form.service';
|
||||||
@ -30,6 +31,7 @@ describe('ActivitiForm', () => {
|
|||||||
let formComponent: ActivitiForm;
|
let formComponent: ActivitiForm;
|
||||||
let visibilityService: WidgetVisibilityService;
|
let visibilityService: WidgetVisibilityService;
|
||||||
let nodeService: NodeService;
|
let nodeService: NodeService;
|
||||||
|
let logService: LogService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||||
@ -37,11 +39,12 @@ describe('ActivitiForm', () => {
|
|||||||
]);
|
]);
|
||||||
window['componentHandler'] = componentHandler;
|
window['componentHandler'] = componentHandler;
|
||||||
|
|
||||||
visibilityService = new WidgetVisibilityService(null);
|
logService = new LogService();
|
||||||
|
visibilityService = new WidgetVisibilityService(null, logService);
|
||||||
spyOn(visibilityService, 'refreshVisibility').and.stub();
|
spyOn(visibilityService, 'refreshVisibility').and.stub();
|
||||||
formService = new FormService(null, null);
|
formService = new FormService(null, null, logService);
|
||||||
nodeService = new NodeService(null);
|
nodeService = new NodeService(null);
|
||||||
formComponent = new ActivitiForm(formService, visibilityService, null, nodeService);
|
formComponent = new ActivitiForm(formService, visibilityService, null, nodeService, logService);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should upgrade MDL content on view checked', () => {
|
it('should upgrade MDL content on view checked', () => {
|
||||||
@ -560,13 +563,6 @@ describe('ActivitiForm', () => {
|
|||||||
expect(formService.completeTaskForm).not.toHaveBeenCalled();
|
expect(formService.completeTaskForm).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should log error to console by default', () => {
|
|
||||||
const error = 'Error';
|
|
||||||
spyOn(console, 'log').and.stub();
|
|
||||||
formComponent.handleError(error);
|
|
||||||
expect(console.log).toHaveBeenCalledWith(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should complete form form and raise corresponding event', () => {
|
it('should complete form form and raise corresponding event', () => {
|
||||||
spyOn(formService, 'completeTaskForm').and.callFake(() => {
|
spyOn(formService, 'completeTaskForm').and.callFake(() => {
|
||||||
return Observable.create(observer => {
|
return Observable.create(observer => {
|
||||||
|
@ -15,14 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import { Component, OnInit, AfterViewChecked, OnChanges, SimpleChanges, Input, Output, EventEmitter } from '@angular/core';
|
||||||
Component,
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
OnInit, AfterViewChecked, OnChanges,
|
|
||||||
SimpleChanges,
|
|
||||||
Input,
|
|
||||||
Output,
|
|
||||||
EventEmitter
|
|
||||||
} from '@angular/core';
|
|
||||||
import { EcmModelService } from './../services/ecm-model.service';
|
import { EcmModelService } from './../services/ecm-model.service';
|
||||||
import { FormService } from './../services/form.service';
|
import { FormService } from './../services/form.service';
|
||||||
import { NodeService } from './../services/node.service';
|
import { NodeService } from './../services/node.service';
|
||||||
@ -149,9 +143,10 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
|
|||||||
debugMode: boolean = false;
|
debugMode: boolean = false;
|
||||||
|
|
||||||
constructor(protected formService: FormService,
|
constructor(protected formService: FormService,
|
||||||
public visibilityService: WidgetVisibilityService,
|
protected visibilityService: WidgetVisibilityService,
|
||||||
private ecmModelService: EcmModelService,
|
private ecmModelService: EcmModelService,
|
||||||
private nodeService: NodeService) {
|
private nodeService: NodeService,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
hasForm(): boolean {
|
hasForm(): boolean {
|
||||||
@ -357,7 +352,6 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
|
|||||||
id => {
|
id => {
|
||||||
this.formService.getFormDefinitionById(id).subscribe(
|
this.formService.getFormDefinitionById(id).subscribe(
|
||||||
form => {
|
form => {
|
||||||
// console.log('Get Form By Form definition Name', form);
|
|
||||||
this.form = this.parseForm(form);
|
this.form = this.parseForm(form);
|
||||||
this.formLoaded.emit(this.form);
|
this.formLoaded.emit(this.form);
|
||||||
},
|
},
|
||||||
@ -405,7 +399,7 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleError(err: any): any {
|
handleError(err: any): any {
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
this.onError.emit(err);
|
this.onError.emit(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,17 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import { Component, AfterViewChecked, OnChanges, SimpleChanges, Input, ViewChild, ElementRef, Output, EventEmitter } from '@angular/core';
|
||||||
Component,
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
AfterViewChecked, OnChanges,
|
|
||||||
SimpleChanges,
|
|
||||||
Input,
|
|
||||||
ViewChild,
|
|
||||||
ElementRef,
|
|
||||||
Output,
|
|
||||||
EventEmitter
|
|
||||||
} from '@angular/core';
|
|
||||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
|
||||||
import { ActivitiForm } from './activiti-form.component';
|
import { ActivitiForm } from './activiti-form.component';
|
||||||
import { FormService } from './../services/form.service';
|
import { FormService } from './../services/form.service';
|
||||||
import { WidgetVisibilityService } from './../services/widget-visibility.service';
|
import { WidgetVisibilityService } from './../services/widget-visibility.service';
|
||||||
@ -74,10 +65,11 @@ export class ActivitiStartForm extends ActivitiForm implements AfterViewChecked,
|
|||||||
@ViewChild('outcomesContainer', {})
|
@ViewChild('outcomesContainer', {})
|
||||||
outcomesContainer: ElementRef = null;
|
outcomesContainer: ElementRef = null;
|
||||||
|
|
||||||
constructor(private translate: AlfrescoTranslationService,
|
constructor(private translate: AlfrescoTranslateService,
|
||||||
formService: FormService,
|
formService: FormService,
|
||||||
visibilityService: WidgetVisibilityService) {
|
visibilityService: WidgetVisibilityService,
|
||||||
super(formService, visibilityService, null, null);
|
logService: LogService) {
|
||||||
|
super(formService, visibilityService, null, null, logService);
|
||||||
|
|
||||||
if (this.translate) {
|
if (this.translate) {
|
||||||
this.translate.addTranslationFolder('ng2-activiti-form', 'node_modules/ng2-activiti-form/src');
|
this.translate.addTranslationFolder('ng2-activiti-form', 'node_modules/ng2-activiti-form/src');
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
import { LogServiceMock } from 'ng2-alfresco-core';
|
||||||
import { AttachWidget } from './attach.widget';
|
import { AttachWidget } from './attach.widget';
|
||||||
import { ActivitiAlfrescoContentService } from '../../../services/activiti-alfresco.service';
|
import { ActivitiAlfrescoContentService } from '../../../services/activiti-alfresco.service';
|
||||||
import { FormFieldModel } from './../core/form-field.model';
|
import { FormFieldModel } from './../core/form-field.model';
|
||||||
@ -28,10 +29,12 @@ describe('AttachWidget', () => {
|
|||||||
let widget: AttachWidget;
|
let widget: AttachWidget;
|
||||||
let contentService: ActivitiAlfrescoContentService;
|
let contentService: ActivitiAlfrescoContentService;
|
||||||
let dialogPolyfill: any;
|
let dialogPolyfill: any;
|
||||||
|
let logService: LogServiceMock;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
contentService = new ActivitiAlfrescoContentService(null);
|
logService = new LogServiceMock();
|
||||||
widget = new AttachWidget(contentService);
|
contentService = new ActivitiAlfrescoContentService(null, logService);
|
||||||
|
widget = new AttachWidget(contentService, logService);
|
||||||
|
|
||||||
dialogPolyfill = {
|
dialogPolyfill = {
|
||||||
registerDialog(obj: any) {
|
registerDialog(obj: any) {
|
||||||
@ -268,9 +271,9 @@ describe('AttachWidget', () => {
|
|||||||
Observable.throw(error)
|
Observable.throw(error)
|
||||||
);
|
);
|
||||||
|
|
||||||
spyOn(console, 'log').and.stub();
|
spyOn(logService, 'error').and.stub();
|
||||||
widget.getExternalContentNodes();
|
widget.getExternalContentNodes();
|
||||||
expect(console.log).toHaveBeenCalledWith(error);
|
expect(logService.error).toHaveBeenCalledWith(error);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should register dialog via polyfill', () => {
|
it('should register dialog via polyfill', () => {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit, Input, Output, EventEmitter, ViewChild } from '@angular/core';
|
import { Component, OnInit, Input, Output, EventEmitter, ViewChild } from '@angular/core';
|
||||||
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
import { WidgetComponent } from './../widget.component';
|
import { WidgetComponent } from './../widget.component';
|
||||||
import { ActivitiAlfrescoContentService } from '../../../services/activiti-alfresco.service';
|
import { ActivitiAlfrescoContentService } from '../../../services/activiti-alfresco.service';
|
||||||
import { ExternalContent } from '../core/external-content';
|
import { ExternalContent } from '../core/external-content';
|
||||||
@ -49,7 +50,8 @@ export class AttachWidget extends WidgetComponent implements OnInit {
|
|||||||
@ViewChild('dialog')
|
@ViewChild('dialog')
|
||||||
dialog: any;
|
dialog: any;
|
||||||
|
|
||||||
constructor(private contentService: ActivitiAlfrescoContentService) {
|
constructor(private contentService: ActivitiAlfrescoContentService,
|
||||||
|
private logService: LogService) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +99,7 @@ export class AttachWidget extends WidgetComponent implements OnInit {
|
|||||||
this.contentService.getAlfrescoNodes(this.selectedFolderAccountId, this.selectedFolderPathId)
|
this.contentService.getAlfrescoNodes(this.selectedFolderAccountId, this.selectedFolderPathId)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
nodes => this.selectedFolderNodes = nodes,
|
nodes => this.selectedFolderNodes = nodes,
|
||||||
error => this.handleError(error)
|
error => this.logService.error(error)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||||
import { CoreModule } from 'ng2-alfresco-core';
|
import { CoreModule, LogServiceMock } from 'ng2-alfresco-core';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { DisplayValueWidget } from './display-value.widget';
|
import { DisplayValueWidget } from './display-value.widget';
|
||||||
import { FormService } from '../../../services/form.service';
|
import { FormService } from '../../../services/form.service';
|
||||||
@ -32,11 +32,13 @@ describe('DisplayValueWidget', () => {
|
|||||||
let widget: DisplayValueWidget;
|
let widget: DisplayValueWidget;
|
||||||
let formService: FormService;
|
let formService: FormService;
|
||||||
let visibilityService: WidgetVisibilityService;
|
let visibilityService: WidgetVisibilityService;
|
||||||
|
let logService: LogServiceMock;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
formService = new FormService(null, null);
|
logService = new LogServiceMock();
|
||||||
visibilityService = new WidgetVisibilityService(null);
|
formService = new FormService(null, null, logService);
|
||||||
widget = new DisplayValueWidget(formService, visibilityService);
|
visibilityService = new WidgetVisibilityService(null, logService);
|
||||||
|
widget = new DisplayValueWidget(formService, visibilityService, logService);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should require field to setup default value', () => {
|
it('should require field to setup default value', () => {
|
||||||
@ -390,7 +392,7 @@ describe('DisplayValueWidget', () => {
|
|||||||
Observable.throw(error)
|
Observable.throw(error)
|
||||||
);
|
);
|
||||||
|
|
||||||
spyOn(console, 'log').and.stub();
|
spyOn(logService, 'error').and.stub();
|
||||||
|
|
||||||
let form = new FormModel({taskId: '<id>'});
|
let form = new FormModel({taskId: '<id>'});
|
||||||
|
|
||||||
@ -406,7 +408,7 @@ describe('DisplayValueWidget', () => {
|
|||||||
});
|
});
|
||||||
widget.ngOnInit();
|
widget.ngOnInit();
|
||||||
expect(formService.getRestFieldValues).toHaveBeenCalled();
|
expect(formService.getRestFieldValues).toHaveBeenCalled();
|
||||||
expect(console.log).toHaveBeenCalledWith(error);
|
expect(logService.error).toHaveBeenCalledWith(error);
|
||||||
expect(widget.value).toBe('100');
|
expect(widget.value).toBe('100');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
import { WidgetComponent } from './../widget.component';
|
import { WidgetComponent } from './../widget.component';
|
||||||
import { FormFieldTypes } from '../core/form-field-types';
|
import { FormFieldTypes } from '../core/form-field-types';
|
||||||
import { FormService } from '../../../services/form.service';
|
import { FormService } from '../../../services/form.service';
|
||||||
@ -49,7 +50,8 @@ export class DisplayValueWidget extends WidgetComponent implements OnInit {
|
|||||||
hasFile: boolean = false;
|
hasFile: boolean = false;
|
||||||
|
|
||||||
constructor(private formService: FormService,
|
constructor(private formService: FormService,
|
||||||
private visibilityService: WidgetVisibilityService) {
|
private visibilityService: WidgetVisibilityService,
|
||||||
|
private logService: LogService) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +184,7 @@ export class DisplayValueWidget extends WidgetComponent implements OnInit {
|
|||||||
this.visibilityService.refreshVisibility(this.field.form);
|
this.visibilityService.refreshVisibility(this.field.form);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log(error);
|
this.logService.error(error);
|
||||||
this.value = this.field.value;
|
this.value = this.field.value;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -192,21 +194,21 @@ export class DisplayValueWidget extends WidgetComponent implements OnInit {
|
|||||||
this.formService
|
this.formService
|
||||||
.getRestFieldValues(this.field.form.taskId, this.field.id)
|
.getRestFieldValues(this.field.form.taskId, this.field.id)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(result: FormFieldOption[]) => {
|
(result: FormFieldOption[]) => {
|
||||||
let options = result || [];
|
let options = result || [];
|
||||||
let toSelect = options.find(item => item.id === this.field.value);
|
let toSelect = options.find(item => item.id === this.field.value);
|
||||||
this.field.options = options;
|
this.field.options = options;
|
||||||
if (toSelect) {
|
if (toSelect) {
|
||||||
this.value = toSelect.name;
|
this.value = toSelect.name;
|
||||||
} else {
|
} else {
|
||||||
|
this.value = this.field.value;
|
||||||
|
}
|
||||||
|
this.visibilityService.refreshVisibility(this.field.form);
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
this.logService.error(error);
|
||||||
this.value = this.field.value;
|
this.value = this.field.value;
|
||||||
}
|
}
|
||||||
this.visibilityService.refreshVisibility(this.field.form);
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
console.log(error);
|
|
||||||
this.value = this.field.value;
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
import { CoreModule } from 'ng2-alfresco-core';
|
||||||
import { FormService } from '../../../services/form.service';
|
import { FormService } from '../../../services/form.service';
|
||||||
import { DropdownWidget } from './dropdown.widget';
|
import { DropdownWidget } from './dropdown.widget';
|
||||||
import { FormModel } from './../core/form.model';
|
import { FormModel } from './../core/form.model';
|
||||||
import { FormFieldModel } from './../core/form-field.model';
|
import { FormFieldModel } from './../core/form-field.model';
|
||||||
import { FormFieldOption } from './../core/form-field-option';
|
import { FormFieldOption } from './../core/form-field-option';
|
||||||
import { CoreModule } from 'ng2-alfresco-core';
|
|
||||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
|
||||||
import { EcmModelService } from '../../../services/ecm-model.service';
|
import { EcmModelService } from '../../../services/ecm-model.service';
|
||||||
import { WidgetVisibilityService } from '../../../services/widget-visibility.service';
|
import { WidgetVisibilityService } from '../../../services/widget-visibility.service';
|
||||||
|
|
||||||
@ -33,9 +33,9 @@ describe('DropdownWidget', () => {
|
|||||||
let visibilityService: WidgetVisibilityService;
|
let visibilityService: WidgetVisibilityService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
formService = new FormService(null, null);
|
formService = new FormService(null, null, null);
|
||||||
visibilityService = new WidgetVisibilityService(null);
|
visibilityService = new WidgetVisibilityService(null, null);
|
||||||
widget = new DropdownWidget(formService, visibilityService);
|
widget = new DropdownWidget(formService, visibilityService, null);
|
||||||
widget.field = new FormFieldModel(new FormModel());
|
widget.field = new FormFieldModel(new FormModel());
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -74,12 +74,6 @@ describe('DropdownWidget', () => {
|
|||||||
expect(formService.getRestFieldValues).toHaveBeenCalledWith(taskId, fieldId);
|
expect(formService.getRestFieldValues).toHaveBeenCalledWith(taskId, fieldId);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should log error to console by default', () => {
|
|
||||||
spyOn(console, 'error').and.stub();
|
|
||||||
widget.handleError('Err');
|
|
||||||
expect(console.error).toHaveBeenCalledWith('Err');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should preserve empty option when loading fields', () => {
|
it('should preserve empty option when loading fields', () => {
|
||||||
let restFieldValue: FormFieldOption = <FormFieldOption> { id: '1', name: 'Option1' };
|
let restFieldValue: FormFieldOption = <FormFieldOption> { id: '1', name: 'Option1' };
|
||||||
spyOn(formService, 'getRestFieldValues').and.returnValue(
|
spyOn(formService, 'getRestFieldValues').and.returnValue(
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
import { FormService } from '../../../services/form.service';
|
import { FormService } from '../../../services/form.service';
|
||||||
import { WidgetComponent } from './../widget.component';
|
import { WidgetComponent } from './../widget.component';
|
||||||
import { FormFieldOption } from './../core/form-field-option';
|
import { FormFieldOption } from './../core/form-field-option';
|
||||||
@ -30,7 +31,8 @@ import { WidgetVisibilityService } from '../../../services/widget-visibility.ser
|
|||||||
export class DropdownWidget extends WidgetComponent implements OnInit {
|
export class DropdownWidget extends WidgetComponent implements OnInit {
|
||||||
|
|
||||||
constructor(private formService: FormService,
|
constructor(private formService: FormService,
|
||||||
private visibilityService: WidgetVisibilityService) {
|
private visibilityService: WidgetVisibilityService,
|
||||||
|
private logService: LogService) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +99,7 @@ export class DropdownWidget extends WidgetComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleError(error: any) {
|
handleError(error: any) {
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { LogServiceMock } from 'ng2-alfresco-core';
|
||||||
import { DynamicTableWidget } from './dynamic-table.widget';
|
import { DynamicTableWidget } from './dynamic-table.widget';
|
||||||
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn } from './dynamic-table.widget.model';
|
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn } from './dynamic-table.widget.model';
|
||||||
import { FormModel, FormFieldTypes } from './../core/index';
|
import { FormModel, FormFieldTypes } from './../core/index';
|
||||||
@ -25,11 +26,13 @@ describe('DynamicTableWidget', () => {
|
|||||||
let widget: DynamicTableWidget;
|
let widget: DynamicTableWidget;
|
||||||
let table: DynamicTableModel;
|
let table: DynamicTableModel;
|
||||||
let visibilityService: WidgetVisibilityService;
|
let visibilityService: WidgetVisibilityService;
|
||||||
|
let logService: LogServiceMock;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
logService = new LogServiceMock();
|
||||||
table = new DynamicTableModel(null);
|
table = new DynamicTableModel(null);
|
||||||
visibilityService = new WidgetVisibilityService(null);
|
visibilityService = new WidgetVisibilityService(null, logService);
|
||||||
widget = new DynamicTableWidget(null, visibilityService);
|
widget = new DynamicTableWidget(null, visibilityService, logService);
|
||||||
widget.content = table;
|
widget.content = table;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -192,13 +195,13 @@ describe('DynamicTableWidget', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should require table to save changes', () => {
|
it('should require table to save changes', () => {
|
||||||
spyOn(console, 'log').and.stub();
|
spyOn(logService, 'error').and.stub();
|
||||||
widget.editMode = true;
|
widget.editMode = true;
|
||||||
widget.content = null;
|
widget.content = null;
|
||||||
widget.onSaveChanges();
|
widget.onSaveChanges();
|
||||||
|
|
||||||
expect(widget.editMode).toBeFalsy();
|
expect(widget.editMode).toBeFalsy();
|
||||||
expect(console.log).toHaveBeenCalledWith(widget.ERROR_MODEL_NOT_FOUND);
|
expect(logService.error).toHaveBeenCalledWith(widget.ERROR_MODEL_NOT_FOUND);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should cancel changes', () => {
|
it('should cancel changes', () => {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, ElementRef, OnInit } from '@angular/core';
|
import { Component, ElementRef, OnInit } from '@angular/core';
|
||||||
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
import { WidgetComponent } from './../widget.component';
|
import { WidgetComponent } from './../widget.component';
|
||||||
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn } from './dynamic-table.widget.model';
|
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn } from './dynamic-table.widget.model';
|
||||||
import { WidgetVisibilityService } from '../../../services/widget-visibility.service';
|
import { WidgetVisibilityService } from '../../../services/widget-visibility.service';
|
||||||
@ -36,7 +37,8 @@ export class DynamicTableWidget extends WidgetComponent implements OnInit {
|
|||||||
editRow: DynamicTableRow = null;
|
editRow: DynamicTableRow = null;
|
||||||
|
|
||||||
constructor(private elementRef: ElementRef,
|
constructor(private elementRef: ElementRef,
|
||||||
private visibilityService: WidgetVisibilityService) {
|
private visibilityService: WidgetVisibilityService,
|
||||||
|
private logService: LogService) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +138,7 @@ export class DynamicTableWidget extends WidgetComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
this.content.flushValue();
|
this.content.flushValue();
|
||||||
} else {
|
} else {
|
||||||
this.handleError(this.ERROR_MODEL_NOT_FOUND);
|
this.logService.error(this.ERROR_MODEL_NOT_FOUND);
|
||||||
}
|
}
|
||||||
this.editMode = false;
|
this.editMode = false;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ describe('DropdownEditorComponent', () => {
|
|||||||
let row: DynamicTableRow;
|
let row: DynamicTableRow;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
formService = new FormService(null, null);
|
formService = new FormService(null, null, null);
|
||||||
|
|
||||||
row = <DynamicTableRow> { value: { dropdown: 'one' } };
|
row = <DynamicTableRow> { value: { dropdown: 'one' } };
|
||||||
column = <DynamicTableColumn> {
|
column = <DynamicTableColumn> {
|
||||||
@ -56,7 +56,7 @@ describe('DropdownEditorComponent', () => {
|
|||||||
table.rows.push(row);
|
table.rows.push(row);
|
||||||
table.columns.push(column);
|
table.columns.push(column);
|
||||||
|
|
||||||
component = new DropdownEditorComponent(formService);
|
component = new DropdownEditorComponent(formService, null);
|
||||||
component.table = table;
|
component.table = table;
|
||||||
component.row = row;
|
component.row = row;
|
||||||
component.column = column;
|
component.column = column;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn, DynamicTableColumnOption } from './../../dynamic-table.widget.model';
|
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn, DynamicTableColumnOption } from './../../dynamic-table.widget.model';
|
||||||
import { FormService } from './../../../../../services/form.service';
|
import { FormService } from './../../../../../services/form.service';
|
||||||
|
|
||||||
@ -39,7 +40,9 @@ export class DropdownEditorComponent implements OnInit {
|
|||||||
@Input()
|
@Input()
|
||||||
column: DynamicTableColumn;
|
column: DynamicTableColumn;
|
||||||
|
|
||||||
constructor(private formService: FormService) {}
|
constructor(private formService: FormService,
|
||||||
|
private logService: LogService) {
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
let field = this.table.field;
|
let field = this.table.field;
|
||||||
@ -98,6 +101,6 @@ export class DropdownEditorComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleError(error: any) {
|
handleError(error: any) {
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ describe('FunctionalGroupWidget', () => {
|
|||||||
]);
|
]);
|
||||||
window['componentHandler'] = componentHandler;
|
window['componentHandler'] = componentHandler;
|
||||||
|
|
||||||
formService = new FormService(null, null);
|
formService = new FormService(null, null, null);
|
||||||
elementRef = new ElementRef(null);
|
elementRef = new ElementRef(null);
|
||||||
widget = new FunctionalGroupWidget(formService, elementRef);
|
widget = new FunctionalGroupWidget(formService, elementRef);
|
||||||
widget.field = new FormFieldModel(new FormModel());
|
widget.field = new FormFieldModel(new FormModel());
|
||||||
|
@ -36,7 +36,7 @@ describe('PeopleWidget', () => {
|
|||||||
]);
|
]);
|
||||||
window['componentHandler'] = componentHandler;
|
window['componentHandler'] = componentHandler;
|
||||||
|
|
||||||
formService = new FormService(null, null);
|
formService = new FormService(null, null, null);
|
||||||
elementRef = new ElementRef(null);
|
elementRef = new ElementRef(null);
|
||||||
widget = new PeopleWidget(formService, elementRef);
|
widget = new PeopleWidget(formService, elementRef);
|
||||||
widget.field = new FormFieldModel(new FormModel());
|
widget.field = new FormFieldModel(new FormModel());
|
||||||
|
@ -15,13 +15,14 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
import { CoreModule, LogServiceMock } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
import { FormService } from '../../../services/form.service';
|
import { FormService } from '../../../services/form.service';
|
||||||
import { RadioButtonsWidget } from './radio-buttons.widget';
|
import { RadioButtonsWidget } from './radio-buttons.widget';
|
||||||
import { FormModel } from './../core/form.model';
|
import { FormModel } from './../core/form.model';
|
||||||
import { FormFieldModel } from './../core/form-field.model';
|
import { FormFieldModel } from './../core/form-field.model';
|
||||||
import { CoreModule } from 'ng2-alfresco-core';
|
|
||||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
|
||||||
import { EcmModelService } from '../../../services/ecm-model.service';
|
import { EcmModelService } from '../../../services/ecm-model.service';
|
||||||
import { WidgetVisibilityService } from '../../../services/widget-visibility.service';
|
import { WidgetVisibilityService } from '../../../services/widget-visibility.service';
|
||||||
import { FormFieldTypes } from '../core/form-field-types';
|
import { FormFieldTypes } from '../core/form-field-types';
|
||||||
@ -33,11 +34,13 @@ describe('RadioButtonsWidget', () => {
|
|||||||
let formService: FormService;
|
let formService: FormService;
|
||||||
let widget: RadioButtonsWidget;
|
let widget: RadioButtonsWidget;
|
||||||
let visibilityService: WidgetVisibilityService;
|
let visibilityService: WidgetVisibilityService;
|
||||||
|
let logService: LogServiceMock;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
formService = new FormService(null, null);
|
logService = new LogServiceMock();
|
||||||
visibilityService = new WidgetVisibilityService(null);
|
formService = new FormService(null, null, logService);
|
||||||
widget = new RadioButtonsWidget(formService, visibilityService);
|
visibilityService = new WidgetVisibilityService(null, logService);
|
||||||
|
widget = new RadioButtonsWidget(formService, visibilityService, logService);
|
||||||
widget.field = new FormFieldModel(new FormModel(), { restUrl: '<url>' });
|
widget.field = new FormFieldModel(new FormModel(), { restUrl: '<url>' });
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -118,9 +121,9 @@ describe('RadioButtonsWidget', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should log error to console by default', () => {
|
it('should log error to console by default', () => {
|
||||||
spyOn(console, 'error').and.stub();
|
spyOn(logService, 'error').and.stub();
|
||||||
widget.handleError('Err');
|
widget.handleError('Err');
|
||||||
expect(console.error).toHaveBeenCalledWith('Err');
|
expect(logService.error).toHaveBeenCalledWith('Err');
|
||||||
});
|
});
|
||||||
|
|
||||||
xit('should update the field value when an option is selected', () => {
|
xit('should update the field value when an option is selected', () => {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
import { WidgetComponent } from './../widget.component';
|
import { WidgetComponent } from './../widget.component';
|
||||||
import { FormService } from '../../../services/form.service';
|
import { FormService } from '../../../services/form.service';
|
||||||
import { FormFieldOption } from './../core/form-field-option';
|
import { FormFieldOption } from './../core/form-field-option';
|
||||||
@ -30,7 +31,8 @@ import { WidgetVisibilityService } from '../../../services/widget-visibility.ser
|
|||||||
export class RadioButtonsWidget extends WidgetComponent implements OnInit {
|
export class RadioButtonsWidget extends WidgetComponent implements OnInit {
|
||||||
|
|
||||||
constructor(private formService: FormService,
|
constructor(private formService: FormService,
|
||||||
private visibilityService: WidgetVisibilityService) {
|
private visibilityService: WidgetVisibilityService,
|
||||||
|
private logService: LogService) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +86,7 @@ export class RadioButtonsWidget extends WidgetComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleError(error: any) {
|
handleError(error: any) {
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,15 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
import { CoreModule, LogServiceMock } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
import { TypeaheadWidget } from './typeahead.widget';
|
import { TypeaheadWidget } from './typeahead.widget';
|
||||||
import { FormService } from '../../../services/form.service';
|
import { FormService } from '../../../services/form.service';
|
||||||
import { FormModel } from '../core/form.model';
|
import { FormModel } from '../core/form.model';
|
||||||
import { FormFieldModel } from '../core/form-field.model';
|
import { FormFieldModel } from '../core/form-field.model';
|
||||||
import { FormFieldOption } from '../core/form-field-option';
|
import { FormFieldOption } from '../core/form-field-option';
|
||||||
import { CoreModule } from 'ng2-alfresco-core';
|
|
||||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
|
||||||
import { EcmModelService } from '../../../services/ecm-model.service';
|
import { EcmModelService } from '../../../services/ecm-model.service';
|
||||||
import { WidgetVisibilityService } from '../../../services/widget-visibility.service';
|
import { WidgetVisibilityService } from '../../../services/widget-visibility.service';
|
||||||
import { FormFieldTypes } from '../core/form-field-types';
|
import { FormFieldTypes } from '../core/form-field-types';
|
||||||
@ -32,11 +33,13 @@ describe('TypeaheadWidget', () => {
|
|||||||
let formService: FormService;
|
let formService: FormService;
|
||||||
let widget: TypeaheadWidget;
|
let widget: TypeaheadWidget;
|
||||||
let visibilityService: WidgetVisibilityService;
|
let visibilityService: WidgetVisibilityService;
|
||||||
|
let logService: LogServiceMock;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
formService = new FormService(null, null);
|
logService = new LogServiceMock();
|
||||||
visibilityService = new WidgetVisibilityService(null);
|
formService = new FormService(null, null, logService);
|
||||||
widget = new TypeaheadWidget(formService, visibilityService);
|
visibilityService = new WidgetVisibilityService(null, logService);
|
||||||
|
widget = new TypeaheadWidget(formService, visibilityService, logService);
|
||||||
widget.field = new FormFieldModel(new FormModel({ taskId: 'task-id' }));
|
widget.field = new FormFieldModel(new FormModel({ taskId: 'task-id' }));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -73,7 +76,7 @@ describe('TypeaheadWidget', () => {
|
|||||||
});
|
});
|
||||||
const err = 'Error';
|
const err = 'Error';
|
||||||
spyOn(formService, 'getRestFieldValues').and.returnValue(Observable.throw(err));
|
spyOn(formService, 'getRestFieldValues').and.returnValue(Observable.throw(err));
|
||||||
spyOn(widget, 'handleError').and.callThrough();
|
spyOn(widget, 'handleError').and.stub();
|
||||||
|
|
||||||
widget.ngOnInit();
|
widget.ngOnInit();
|
||||||
|
|
||||||
@ -94,7 +97,7 @@ describe('TypeaheadWidget', () => {
|
|||||||
});
|
});
|
||||||
const err = 'Error';
|
const err = 'Error';
|
||||||
spyOn(formService, 'getRestFieldValuesByProcessId').and.returnValue(Observable.throw(err));
|
spyOn(formService, 'getRestFieldValuesByProcessId').and.returnValue(Observable.throw(err));
|
||||||
spyOn(widget, 'handleError').and.callThrough();
|
spyOn(widget, 'handleError').and.stub();
|
||||||
|
|
||||||
widget.ngOnInit();
|
widget.ngOnInit();
|
||||||
|
|
||||||
@ -102,12 +105,6 @@ describe('TypeaheadWidget', () => {
|
|||||||
expect(widget.handleError).toHaveBeenCalledWith(err);
|
expect(widget.handleError).toHaveBeenCalledWith(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should log error to console by default', () => {
|
|
||||||
spyOn(console, 'error').and.stub();
|
|
||||||
widget.handleError('Err');
|
|
||||||
expect(console.error).toHaveBeenCalledWith('Err');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should show popup on key up', () => {
|
it('should show popup on key up', () => {
|
||||||
|
|
||||||
spyOn(widget, 'getOptions').and.returnValue([{}, {}]);
|
spyOn(widget, 'getOptions').and.returnValue([{}, {}]);
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
import { FormService } from './../../../services/form.service';
|
import { FormService } from './../../../services/form.service';
|
||||||
import { WidgetComponent } from './../widget.component';
|
import { WidgetComponent } from './../widget.component';
|
||||||
import { FormFieldOption } from './../core/form-field-option';
|
import { FormFieldOption } from './../core/form-field-option';
|
||||||
@ -35,7 +36,8 @@ export class TypeaheadWidget extends WidgetComponent implements OnInit {
|
|||||||
options: FormFieldOption[] = [];
|
options: FormFieldOption[] = [];
|
||||||
|
|
||||||
constructor(private formService: FormService,
|
constructor(private formService: FormService,
|
||||||
private visibilityService: WidgetVisibilityService) {
|
private visibilityService: WidgetVisibilityService,
|
||||||
|
private logService: LogService) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +155,7 @@ export class TypeaheadWidget extends WidgetComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleError(error: any) {
|
handleError(error: any) {
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkVisibility() {
|
checkVisibility() {
|
||||||
|
@ -26,8 +26,8 @@ describe('UploadWidget', () => {
|
|||||||
let formService: FormService;
|
let formService: FormService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
formService = new FormService(null, null);
|
formService = new FormService(null, null, null);
|
||||||
widget = new UploadWidget(formService);
|
widget = new UploadWidget(formService, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should setup with field data', () => {
|
it('should setup with field data', () => {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
import { WidgetComponent } from './../widget.component';
|
import { WidgetComponent } from './../widget.component';
|
||||||
import { FormService } from '../../../services/form.service';
|
import { FormService } from '../../../services/form.service';
|
||||||
|
|
||||||
@ -31,7 +32,8 @@ export class UploadWidget extends WidgetComponent implements OnInit {
|
|||||||
fileName: string;
|
fileName: string;
|
||||||
displayText: string;
|
displayText: string;
|
||||||
|
|
||||||
constructor(private formService: FormService) {
|
constructor(private formService: FormService,
|
||||||
|
private logService: LogService) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,16 +62,14 @@ export class UploadWidget extends WidgetComponent implements OnInit {
|
|||||||
onFileChanged(event: any) {
|
onFileChanged(event: any) {
|
||||||
let files = event.target.files;
|
let files = event.target.files;
|
||||||
if (files && files.length > 0) {
|
if (files && files.length > 0) {
|
||||||
|
|
||||||
let file = files[0];
|
let file = files[0];
|
||||||
|
|
||||||
this.formService.createTemporaryRawRelatedContent(file)
|
this.formService.createTemporaryRawRelatedContent(file)
|
||||||
.subscribe((response: any) => {
|
.subscribe((response: any) => {
|
||||||
console.log(response);
|
this.logService.info(response);
|
||||||
this.field.value = [response];
|
this.field.value = [response];
|
||||||
this.field.json.value = [response];
|
this.field.json.value = [response];
|
||||||
}, (error: any) => {
|
}, (error: any) => {
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
window.alert('Error uploading file. See console output for more details.');
|
window.alert('Error uploading file. See console output for more details.');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -111,11 +111,4 @@ export class WidgetComponent implements AfterViewInit {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected handleError(error: any) {
|
|
||||||
if (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
import { AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||||
import { ExternalContent } from '../components/widgets/core/external-content';
|
import { ExternalContent } from '../components/widgets/core/external-content';
|
||||||
import { ExternalContentLink } from '../components/widgets/core/external-content-link';
|
import { ExternalContentLink } from '../components/widgets/core/external-content-link';
|
||||||
import { AlfrescoApi } from 'alfresco-js-api';
|
import { AlfrescoApi } from 'alfresco-js-api';
|
||||||
@ -28,7 +28,8 @@ export class ActivitiAlfrescoContentService {
|
|||||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService) {
|
constructor(private apiService: AlfrescoApiService,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,7 +86,7 @@ export class ActivitiAlfrescoContentService {
|
|||||||
errMsg = (error.message) ? error.message :
|
errMsg = (error.message) ? error.message :
|
||||||
error.status ? `${error.status} - ${error.statusText}` : ActivitiAlfrescoContentService.GENERIC_ERROR_MESSAGE;
|
error.status ? `${error.status} - ${error.statusText}` : ActivitiAlfrescoContentService.GENERIC_ERROR_MESSAGE;
|
||||||
}
|
}
|
||||||
console.error(errMsg);
|
this.logService.error(errMsg);
|
||||||
return Observable.throw(errMsg);
|
return Observable.throw(errMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
import { AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||||
import { FormModel } from '../components/widgets/core/form.model';
|
import { FormModel } from '../components/widgets/core/form.model';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -27,7 +27,8 @@ export class EcmModelService {
|
|||||||
public static MODEL_NAME: string = 'activitiFormsModel';
|
public static MODEL_NAME: string = 'activitiFormsModel';
|
||||||
public static TYPE_MODEL: string = 'cm:folder';
|
public static TYPE_MODEL: string = 'cm:folder';
|
||||||
|
|
||||||
constructor(public apiService: AlfrescoApiService) {
|
constructor(private apiService: AlfrescoApiService,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public createEcmTypeForActivitiForm(formName: string, form: FormModel): Observable<any> {
|
public createEcmTypeForActivitiForm(formName: string, form: FormModel): Observable<any> {
|
||||||
@ -62,10 +63,10 @@ export class EcmModelService {
|
|||||||
return Observable.create(observer => {
|
return Observable.create(observer => {
|
||||||
this.createEcmModel(EcmModelService.MODEL_NAME, EcmModelService.MODEL_NAMESPACE).subscribe(
|
this.createEcmModel(EcmModelService.MODEL_NAME, EcmModelService.MODEL_NAMESPACE).subscribe(
|
||||||
model => {
|
model => {
|
||||||
console.log('model created', model);
|
this.logService.info('model created', model);
|
||||||
this.activeEcmModel(EcmModelService.MODEL_NAME).subscribe(
|
this.activeEcmModel(EcmModelService.MODEL_NAME).subscribe(
|
||||||
modelActive => {
|
modelActive => {
|
||||||
console.log('model active', modelActive);
|
this.logService.info('model active', modelActive);
|
||||||
this.createEcmTypeWithProperties(formName, form).subscribe(typeCreated => {
|
this.createEcmTypeWithProperties(formName, form).subscribe(typeCreated => {
|
||||||
observer.next(typeCreated);
|
observer.next(typeCreated);
|
||||||
observer.complete();
|
observer.complete();
|
||||||
@ -83,7 +84,7 @@ export class EcmModelService {
|
|||||||
return Observable.create(observer => {
|
return Observable.create(observer => {
|
||||||
this.searchEcmType(formName, EcmModelService.MODEL_NAME).subscribe(
|
this.searchEcmType(formName, EcmModelService.MODEL_NAME).subscribe(
|
||||||
ecmType => {
|
ecmType => {
|
||||||
console.log('custom types', ecmType);
|
this.logService.info('custom types', ecmType);
|
||||||
if (!ecmType) {
|
if (!ecmType) {
|
||||||
this.createEcmTypeWithProperties(formName, form).subscribe(typeCreated => {
|
this.createEcmTypeWithProperties(formName, form).subscribe(typeCreated => {
|
||||||
observer.next(typeCreated);
|
observer.next(typeCreated);
|
||||||
@ -103,10 +104,10 @@ export class EcmModelService {
|
|||||||
return Observable.create(observer => {
|
return Observable.create(observer => {
|
||||||
this.createEcmType(formName, EcmModelService.MODEL_NAME, EcmModelService.TYPE_MODEL).subscribe(
|
this.createEcmType(formName, EcmModelService.MODEL_NAME, EcmModelService.TYPE_MODEL).subscribe(
|
||||||
typeCreated => {
|
typeCreated => {
|
||||||
console.log('type Created', typeCreated);
|
this.logService.info('type Created', typeCreated);
|
||||||
this.addPropertyToAType(EcmModelService.MODEL_NAME, formName, form).subscribe(
|
this.addPropertyToAType(EcmModelService.MODEL_NAME, formName, form).subscribe(
|
||||||
properyAdded => {
|
properyAdded => {
|
||||||
console.log('property Added', properyAdded);
|
this.logService.info('property Added', properyAdded);
|
||||||
observer.next(typeCreated);
|
observer.next(typeCreated);
|
||||||
observer.complete();
|
observer.complete();
|
||||||
},
|
},
|
||||||
@ -196,6 +197,6 @@ export class EcmModelService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleError(err: any): any {
|
handleError(err: any): any {
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { CoreModule, AlfrescoApiService } from 'ng2-alfresco-core';
|
import { CoreModule, AlfrescoApiService, LogService, LogServiceMock } from 'ng2-alfresco-core';
|
||||||
import { FormService } from './form.service';
|
import { FormService } from './form.service';
|
||||||
import { EcmModelService } from './ecm-model.service';
|
import { EcmModelService } from './ecm-model.service';
|
||||||
import { FormDefinitionModel } from '../models/form-definition.model';
|
import { FormDefinitionModel } from '../models/form-definition.model';
|
||||||
@ -29,6 +29,7 @@ describe('FormService', () => {
|
|||||||
let responseBody: any;
|
let responseBody: any;
|
||||||
let service: FormService;
|
let service: FormService;
|
||||||
let apiService: AlfrescoApiService;
|
let apiService: AlfrescoApiService;
|
||||||
|
let logService: LogService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@ -37,11 +38,13 @@ describe('FormService', () => {
|
|||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
EcmModelService,
|
EcmModelService,
|
||||||
FormService
|
FormService,
|
||||||
|
{ provide: LogService, useClass: LogServiceMock }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
service = TestBed.get(FormService);
|
service = TestBed.get(FormService);
|
||||||
apiService = TestBed.get(AlfrescoApiService);
|
apiService = TestBed.get(AlfrescoApiService);
|
||||||
|
logService = TestBed.get(LogService);
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@ -270,34 +273,34 @@ describe('FormService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle error with generic message', () => {
|
it('should handle error with generic message', () => {
|
||||||
spyOn(console, 'error').and.stub();
|
spyOn(logService, 'error').and.stub();
|
||||||
|
|
||||||
service.handleError(null);
|
service.handleError(null);
|
||||||
expect(console.error).toHaveBeenCalledWith(FormService.UNKNOWN_ERROR_MESSAGE);
|
expect(logService.error).toHaveBeenCalledWith(FormService.UNKNOWN_ERROR_MESSAGE);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle error with error message', () => {
|
it('should handle error with error message', () => {
|
||||||
spyOn(console, 'error').and.stub();
|
spyOn(logService, 'error').and.stub();
|
||||||
|
|
||||||
const message = '<error>';
|
const message = '<error>';
|
||||||
service.handleError({message: message});
|
service.handleError({message: message});
|
||||||
|
|
||||||
expect(console.error).toHaveBeenCalledWith(message);
|
expect(logService.error).toHaveBeenCalledWith(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle error with detailed message', () => {
|
it('should handle error with detailed message', () => {
|
||||||
spyOn(console, 'error').and.stub();
|
spyOn(logService, 'error').and.stub();
|
||||||
service.handleError({
|
service.handleError({
|
||||||
status: '400',
|
status: '400',
|
||||||
statusText: 'Bad request'
|
statusText: 'Bad request'
|
||||||
});
|
});
|
||||||
expect(console.error).toHaveBeenCalledWith('400 - Bad request');
|
expect(logService.error).toHaveBeenCalledWith('400 - Bad request');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle error with generic message', () => {
|
it('should handle error with generic message', () => {
|
||||||
spyOn(console, 'error').and.stub();
|
spyOn(logService, 'error').and.stub();
|
||||||
service.handleError({});
|
service.handleError({});
|
||||||
expect(console.error).toHaveBeenCalledWith(FormService.GENERIC_ERROR_MESSAGE);
|
expect(logService.error).toHaveBeenCalledWith(FormService.GENERIC_ERROR_MESSAGE);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get all the forms with modelType=2', (done) => {
|
it('should get all the forms with modelType=2', (done) => {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
import { AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||||
import { FormValues } from './../components/widgets/core/index';
|
import { FormValues } from './../components/widgets/core/index';
|
||||||
import { FormDefinitionModel } from '../models/form-definition.model';
|
import { FormDefinitionModel } from '../models/form-definition.model';
|
||||||
import { EcmModelService } from './ecm-model.service';
|
import { EcmModelService } from './ecm-model.service';
|
||||||
@ -31,7 +31,8 @@ export class FormService {
|
|||||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||||
|
|
||||||
constructor(private ecmModelService: EcmModelService,
|
constructor(private ecmModelService: EcmModelService,
|
||||||
private apiService: AlfrescoApiService) {
|
private apiService: AlfrescoApiService,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,11 +272,10 @@ export class FormService {
|
|||||||
if (xhr.status === 200) {
|
if (xhr.status === 200) {
|
||||||
let json = JSON.parse(xhr.response);
|
let json = JSON.parse(xhr.response);
|
||||||
let data: GroupModel[] = (json.data || []).map(item => <GroupModel> item);
|
let data: GroupModel[] = (json.data || []).map(item => <GroupModel> item);
|
||||||
// console.log(json);
|
|
||||||
observer.next(data);
|
observer.next(data);
|
||||||
observer.complete();
|
observer.complete();
|
||||||
} else {
|
} else {
|
||||||
console.error(xhr.response);
|
this.logService.error(xhr.response);
|
||||||
Observable.throw(new Error(xhr.response));
|
Observable.throw(new Error(xhr.response));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,11 +303,10 @@ export class FormService {
|
|||||||
if (xhr.status === 200) {
|
if (xhr.status === 200) {
|
||||||
let json = JSON.parse(xhr.response);
|
let json = JSON.parse(xhr.response);
|
||||||
let data: GroupUserModel[] = (json.data || []).map(item => <GroupUserModel> item);
|
let data: GroupUserModel[] = (json.data || []).map(item => <GroupUserModel> item);
|
||||||
// console.log(json);
|
|
||||||
observer.next(data);
|
observer.next(data);
|
||||||
observer.complete();
|
observer.complete();
|
||||||
} else {
|
} else {
|
||||||
console.error(xhr.response);
|
this.logService.error(xhr.response);
|
||||||
Observable.throw(new Error(xhr.response));
|
Observable.throw(new Error(xhr.response));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -354,7 +353,7 @@ export class FormService {
|
|||||||
errMsg = (error.message) ? error.message :
|
errMsg = (error.message) ? error.message :
|
||||||
error.status ? `${error.status} - ${error.statusText}` : FormService.GENERIC_ERROR_MESSAGE;
|
error.status ? `${error.status} - ${error.statusText}` : FormService.GENERIC_ERROR_MESSAGE;
|
||||||
}
|
}
|
||||||
console.error(errMsg);
|
this.logService.error(errMsg);
|
||||||
return Observable.throw(errMsg);
|
return Observable.throw(errMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,24 +17,19 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
import * as moment from 'moment';
|
||||||
import {
|
import { AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||||
FormModel,
|
import { FormModel, FormFieldModel, TabModel, ContainerModel, ContainerColumnModel } from '../components/widgets/core/index';
|
||||||
FormFieldModel,
|
|
||||||
TabModel,
|
|
||||||
ContainerModel,
|
|
||||||
ContainerColumnModel
|
|
||||||
} from '../components/widgets/core/index';
|
|
||||||
import { WidgetVisibilityModel } from '../models/widget-visibility.model';
|
import { WidgetVisibilityModel } from '../models/widget-visibility.model';
|
||||||
import { TaskProcessVariableModel } from '../models/task-process-variable.model';
|
import { TaskProcessVariableModel } from '../models/task-process-variable.model';
|
||||||
import * as moment from 'moment';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WidgetVisibilityService {
|
export class WidgetVisibilityService {
|
||||||
|
|
||||||
private processVarList: TaskProcessVariableModel[];
|
private processVarList: TaskProcessVariableModel[];
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService) {
|
constructor(private apiService: AlfrescoApiService,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public refreshVisibility(form: FormModel) {
|
public refreshVisibility(form: FormModel) {
|
||||||
@ -201,7 +196,7 @@ export class WidgetVisibilityService {
|
|||||||
case 'or-not':
|
case 'or-not':
|
||||||
return previousValue || !newValue;
|
return previousValue || !newValue;
|
||||||
default:
|
default:
|
||||||
console.error('NO valid operation! wrong op request : ' + logicOp);
|
this.logService.error('NO valid operation! wrong op request : ' + logicOp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,7 +220,7 @@ export class WidgetVisibilityService {
|
|||||||
case '!empty':
|
case '!empty':
|
||||||
return leftValue ? leftValue !== '' : false;
|
return leftValue ? leftValue !== '' : false;
|
||||||
default:
|
default:
|
||||||
console.error('NO valid operation!');
|
this.logService.error('NO valid operation!');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -250,7 +245,7 @@ export class WidgetVisibilityService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleError() {
|
private handleError() {
|
||||||
console.error('Error while performing a call');
|
this.logService.error('Error while performing a call');
|
||||||
return Observable.throw('Error while performing a call - Server error');
|
return Observable.throw('Error while performing a call - Server error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,274 +1,275 @@
|
|||||||
/*!
|
/*!
|
||||||
* @license
|
* @license
|
||||||
* Copyright 2016 Alfresco Software, Ltd.
|
* Copyright 2016 Alfresco Software, Ltd.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { DebugElement, Input, NgModule, Component, OnInit, ViewChild } from '@angular/core';
|
import { DebugElement, Input, NgModule, Component, OnInit, ViewChild } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { AppDefinitionRepresentationModel, ActivitiTaskListModule } from 'ng2-activiti-tasklist';
|
import { AppDefinitionRepresentationModel, ActivitiTaskListModule } from 'ng2-activiti-tasklist';
|
||||||
import { CoreModule } from 'ng2-alfresco-core';
|
import { CoreModule, LogService } from 'ng2-alfresco-core';
|
||||||
import {
|
import {
|
||||||
ActivitiProcessListModule,
|
ActivitiProcessListModule,
|
||||||
ActivitiProcessFilters,
|
ActivitiProcessFilters,
|
||||||
ActivitiProcessInstanceDetails,
|
ActivitiProcessInstanceDetails,
|
||||||
ActivitiProcessInstanceListComponent,
|
ActivitiProcessInstanceListComponent,
|
||||||
ActivitiStartProcessInstance,
|
ActivitiStartProcessInstance,
|
||||||
ProcessInstance
|
ProcessInstance
|
||||||
} from 'ng2-activiti-processlist';
|
} from 'ng2-activiti-processlist';
|
||||||
import { AuthService, SettingsService, StorageService } from 'ng2-alfresco-core';
|
import { AuthService, SettingsService, StorageService } from 'ng2-alfresco-core';
|
||||||
import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
||||||
|
|
||||||
const currentProcessIdNew = '__NEW__';
|
const currentProcessIdNew = '__NEW__';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'alfresco-app-demo',
|
selector: 'alfresco-app-demo',
|
||||||
template: `
|
template: `
|
||||||
<label for="ticket"><b>Insert a valid ticket:</b></label><br>
|
<label for="ticket"><b>Insert a valid ticket:</b></label><br>
|
||||||
<input id="ticket" type="text" size="48" (change)="updateTicket()" [(ngModel)]="ticket"><br>
|
<input id="ticket" type="text" size="48" (change)="updateTicket()" [(ngModel)]="ticket"><br>
|
||||||
<label for="host"><b>Insert the ip of your Activiti instance:</b></label><br>
|
<label for="host"><b>Insert the ip of your Activiti instance:</b></label><br>
|
||||||
<input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="host"><br><br>
|
<input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="host"><br><br>
|
||||||
<div *ngIf="!authenticated" style="color:#FF2323">
|
<div *ngIf="!authenticated" style="color:#FF2323">
|
||||||
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid ticket to perform
|
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid ticket to perform
|
||||||
operations.
|
operations.
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
|
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
|
||||||
|
|
||||||
<header class="mdl-layout__header">
|
<header class="mdl-layout__header">
|
||||||
|
|
||||||
<!-- TABS -->
|
<!-- TABS -->
|
||||||
|
|
||||||
<div class="mdl-layout__tab-bar mdl-js-ripple-effect" #tabheader>
|
<div class="mdl-layout__tab-bar mdl-js-ripple-effect" #tabheader>
|
||||||
<a id="apps-header" href="#apps" class="mdl-layout__tab is-active">APPS</a>
|
<a id="apps-header" href="#apps" class="mdl-layout__tab is-active">APPS</a>
|
||||||
<a id="processes-header" href="#processes" class="mdl-layout__tab">PROCESS LIST</a>
|
<a id="processes-header" href="#processes" class="mdl-layout__tab">PROCESS LIST</a>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main class="mdl-layout__content activiti" #tabmain>
|
<main class="mdl-layout__content activiti" #tabmain>
|
||||||
|
|
||||||
<!-- APPPS COMPONENT -->
|
<!-- APPPS COMPONENT -->
|
||||||
|
|
||||||
<section class="mdl-layout__tab-panel is-active" id="apps">
|
<section class="mdl-layout__tab-panel is-active" id="apps">
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<activiti-apps [layoutType]="'GRID'" (appClick)="onAppClick($event)" #activitiapps></activiti-apps>
|
<activiti-apps [layoutType]="'GRID'" (appClick)="onAppClick($event)" #activitiapps></activiti-apps>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- PROCESS COMPONENT -->
|
<!-- PROCESS COMPONENT -->
|
||||||
|
|
||||||
<section class="mdl-layout__tab-panel" id="processes">
|
<section class="mdl-layout__tab-panel" id="processes">
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<div class="mdl-grid">
|
<div class="mdl-grid">
|
||||||
<div class="mdl-cell mdl-cell--2-col task-column">
|
<div class="mdl-cell mdl-cell--2-col task-column">
|
||||||
<h2>Process Filters</h2>
|
<h2>Process Filters</h2>
|
||||||
<button type="button" (click)="navigateStartProcess()"
|
<button type="button" (click)="navigateStartProcess()"
|
||||||
class="mdl-button" data-automation-id="btn-start-process">Start Process</button>
|
class="mdl-button" data-automation-id="btn-start-process">Start Process</button>
|
||||||
<activiti-process-instance-filters
|
<activiti-process-instance-filters
|
||||||
[appId]="appId"
|
[appId]="appId"
|
||||||
(filterClick)="onProcessFilterClick($event)"
|
(filterClick)="onProcessFilterClick($event)"
|
||||||
(onSuccess)="onSuccessProcessFilterList($event)"></activiti-process-instance-filters>
|
(onSuccess)="onSuccessProcessFilterList($event)"></activiti-process-instance-filters>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-cell mdl-cell--3-col task-column">
|
<div class="mdl-cell mdl-cell--3-col task-column">
|
||||||
<h2>Process List</h2>
|
<h2>Process List</h2>
|
||||||
<activiti-process-instance-list *ngIf="processFilter?.hasFilter()" [appId]="processFilter.appId"
|
<activiti-process-instance-list *ngIf="processFilter?.hasFilter()" [appId]="processFilter.appId"
|
||||||
[processDefinitionKey]="processFilter.filter.processDefinitionKey"
|
[processDefinitionKey]="processFilter.filter.processDefinitionKey"
|
||||||
[name]="processFilter.filter.name"
|
[name]="processFilter.filter.name"
|
||||||
[state]="processFilter.filter.state"
|
[state]="processFilter.filter.state"
|
||||||
[sort]="processFilter.filter.sort"
|
[sort]="processFilter.filter.sort"
|
||||||
[data]="dataProcesses"
|
[data]="dataProcesses"
|
||||||
(rowClick)="onProcessRowClick($event)"
|
(rowClick)="onProcessRowClick($event)"
|
||||||
(onSuccess)="onSuccessProcessList($event)"></activiti-process-instance-list>
|
(onSuccess)="onSuccessProcessList($event)"></activiti-process-instance-list>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-cell mdl-cell--7-col task-column" *ngIf="!isStartProcessMode()">
|
<div class="mdl-cell mdl-cell--7-col task-column" *ngIf="!isStartProcessMode()">
|
||||||
<h2>Process Details</h2>
|
<h2>Process Details</h2>
|
||||||
<activiti-process-instance-details
|
<activiti-process-instance-details
|
||||||
[processInstanceId]="currentProcessInstanceId"
|
[processInstanceId]="currentProcessInstanceId"
|
||||||
(taskFormCompleted)="taskFormCompleted()"
|
(taskFormCompleted)="taskFormCompleted()"
|
||||||
(processCancelled)="processCancelled()"></activiti-process-instance-details>
|
(processCancelled)="processCancelled()"></activiti-process-instance-details>
|
||||||
<h2>Process Variables</h2>
|
<h2>Process Variables</h2>
|
||||||
<activiti-process-instance-variables
|
<activiti-process-instance-variables
|
||||||
[processInstanceId]="currentProcessInstanceId"></activiti-process-instance-variables>
|
[processInstanceId]="currentProcessInstanceId"></activiti-process-instance-variables>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-cell mdl-cell--7-col task-column" *ngIf="isStartProcessMode()">
|
<div class="mdl-cell mdl-cell--7-col task-column" *ngIf="isStartProcessMode()">
|
||||||
<h2>Start Process</h2>
|
<h2>Start Process</h2>
|
||||||
<activiti-start-process [appId]="appId" (start)="onStartProcessInstance($event)"></activiti-start-process>
|
<activiti-start-process [appId]="appId" (start)="onStartProcessInstance($event)"></activiti-start-process>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
styles: [`
|
styles: [`
|
||||||
header {
|
header {
|
||||||
min-height: 48px;
|
min-height: 48px;
|
||||||
}
|
}
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
}
|
}
|
||||||
`]
|
`]
|
||||||
})
|
})
|
||||||
class MyDemoApp implements OnInit {
|
class MyDemoApp implements OnInit {
|
||||||
|
|
||||||
authenticated: boolean;
|
authenticated: boolean;
|
||||||
|
|
||||||
host: string = 'http://localhost:9999';
|
host: string = 'http://localhost:9999';
|
||||||
|
|
||||||
ticket: string;
|
ticket: string;
|
||||||
|
|
||||||
@ViewChild('tabmain')
|
@ViewChild('tabmain')
|
||||||
tabMain: DebugElement;
|
tabMain: DebugElement;
|
||||||
|
|
||||||
@ViewChild('tabheader')
|
@ViewChild('tabheader')
|
||||||
tabHeader: DebugElement;
|
tabHeader: DebugElement;
|
||||||
|
|
||||||
@ViewChild(ActivitiProcessFilters)
|
@ViewChild(ActivitiProcessFilters)
|
||||||
activitiprocessfilter: ActivitiProcessFilters;
|
activitiprocessfilter: ActivitiProcessFilters;
|
||||||
|
|
||||||
@ViewChild(ActivitiProcessInstanceListComponent)
|
@ViewChild(ActivitiProcessInstanceListComponent)
|
||||||
activitiprocesslist: ActivitiProcessInstanceListComponent;
|
activitiprocesslist: ActivitiProcessInstanceListComponent;
|
||||||
|
|
||||||
@ViewChild(ActivitiProcessInstanceDetails)
|
@ViewChild(ActivitiProcessInstanceDetails)
|
||||||
activitiprocessdetails: ActivitiProcessInstanceDetails;
|
activitiprocessdetails: ActivitiProcessInstanceDetails;
|
||||||
|
|
||||||
@ViewChild(ActivitiStartProcessInstance)
|
@ViewChild(ActivitiStartProcessInstance)
|
||||||
activitiStartProcess: ActivitiStartProcessInstance;
|
activitiStartProcess: ActivitiStartProcessInstance;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
appId: number;
|
appId: number;
|
||||||
|
|
||||||
processFilter: any;
|
processFilter: any;
|
||||||
|
|
||||||
currentProcessInstanceId: string;
|
currentProcessInstanceId: string;
|
||||||
|
|
||||||
dataProcesses: ObjectDataTableAdapter;
|
dataProcesses: ObjectDataTableAdapter;
|
||||||
|
|
||||||
constructor(private authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService,
|
||||||
settingsService.bpmHost = this.host;
|
private logService: LogService) {
|
||||||
settingsService.setProviders('BPM');
|
settingsService.bpmHost = this.host;
|
||||||
|
settingsService.setProviders('BPM');
|
||||||
if (this.authService.getTicketBpm()) {
|
|
||||||
this.ticket = this.authService.getTicketBpm();
|
if (this.authService.getTicketBpm()) {
|
||||||
}
|
this.ticket = this.authService.getTicketBpm();
|
||||||
|
}
|
||||||
this.dataProcesses = new ObjectDataTableAdapter(
|
|
||||||
[],
|
this.dataProcesses = new ObjectDataTableAdapter(
|
||||||
[
|
[],
|
||||||
{type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true},
|
[
|
||||||
{type: 'text', key: 'started', title: 'Started', sortable: true, cssClass: 'hidden'}
|
{type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true},
|
||||||
]
|
{type: 'text', key: 'started', title: 'Started', sortable: true, cssClass: 'hidden'}
|
||||||
);
|
]
|
||||||
}
|
);
|
||||||
|
}
|
||||||
public updateTicket(): void {
|
|
||||||
this.storage.setItem('ticket-BPM', this.ticket);
|
public updateTicket(): void {
|
||||||
}
|
this.storage.setItem('ticket-BPM', this.ticket);
|
||||||
|
}
|
||||||
public updateHost(): void {
|
|
||||||
this.settingsService.bpmHost = this.host;
|
public updateHost(): void {
|
||||||
this.login();
|
this.settingsService.bpmHost = this.host;
|
||||||
}
|
this.login();
|
||||||
|
}
|
||||||
public ngOnInit(): void {
|
|
||||||
this.login();
|
public ngOnInit(): void {
|
||||||
}
|
this.login();
|
||||||
|
}
|
||||||
login() {
|
|
||||||
this.authService.login('admin', 'admin').subscribe(
|
login() {
|
||||||
ticket => {
|
this.authService.login('admin', 'admin').subscribe(
|
||||||
console.log(ticket);
|
ticket => {
|
||||||
this.ticket = this.authService.getTicketBpm();
|
this.logService.log(ticket);
|
||||||
this.authenticated = true;
|
this.ticket = this.authService.getTicketBpm();
|
||||||
},
|
this.authenticated = true;
|
||||||
error => {
|
},
|
||||||
console.log(error);
|
error => {
|
||||||
this.authenticated = false;
|
this.logService.error(error);
|
||||||
});
|
this.authenticated = false;
|
||||||
}
|
});
|
||||||
|
}
|
||||||
onAppClick(app: AppDefinitionRepresentationModel) {
|
|
||||||
this.appId = app.id;
|
onAppClick(app: AppDefinitionRepresentationModel) {
|
||||||
|
this.appId = app.id;
|
||||||
this.processFilter = null;
|
|
||||||
this.currentProcessInstanceId = null;
|
this.processFilter = null;
|
||||||
|
this.currentProcessInstanceId = null;
|
||||||
this.changeTab('apps', 'processes');
|
|
||||||
}
|
this.changeTab('apps', 'processes');
|
||||||
|
}
|
||||||
navigateStartProcess() {
|
|
||||||
this.currentProcessInstanceId = currentProcessIdNew;
|
navigateStartProcess() {
|
||||||
}
|
this.currentProcessInstanceId = currentProcessIdNew;
|
||||||
|
}
|
||||||
onStartProcessInstance(instance: ProcessInstance) {
|
|
||||||
this.currentProcessInstanceId = instance.id;
|
onStartProcessInstance(instance: ProcessInstance) {
|
||||||
this.activitiStartProcess.reset();
|
this.currentProcessInstanceId = instance.id;
|
||||||
}
|
this.activitiStartProcess.reset();
|
||||||
|
}
|
||||||
isStartProcessMode() {
|
|
||||||
return this.currentProcessInstanceId === currentProcessIdNew;
|
isStartProcessMode() {
|
||||||
}
|
return this.currentProcessInstanceId === currentProcessIdNew;
|
||||||
|
}
|
||||||
onProcessFilterClick(event: any) {
|
|
||||||
this.processFilter = event;
|
onProcessFilterClick(event: any) {
|
||||||
}
|
this.processFilter = event;
|
||||||
|
}
|
||||||
onSuccessProcessFilterList(event: any) {
|
|
||||||
this.processFilter = this.activitiprocessfilter.getCurrentFilter();
|
onSuccessProcessFilterList(event: any) {
|
||||||
}
|
this.processFilter = this.activitiprocessfilter.getCurrentFilter();
|
||||||
|
}
|
||||||
onSuccessProcessList(event: any) {
|
|
||||||
this.currentProcessInstanceId = this.activitiprocesslist.getCurrentId();
|
onSuccessProcessList(event: any) {
|
||||||
}
|
this.currentProcessInstanceId = this.activitiprocesslist.getCurrentId();
|
||||||
|
}
|
||||||
onProcessRowClick(processInstanceId) {
|
|
||||||
this.currentProcessInstanceId = processInstanceId;
|
onProcessRowClick(processInstanceId) {
|
||||||
}
|
this.currentProcessInstanceId = processInstanceId;
|
||||||
|
}
|
||||||
processCancelled(data: any) {
|
|
||||||
this.currentProcessInstanceId = null;
|
processCancelled(data: any) {
|
||||||
this.activitiprocesslist.reload();
|
this.currentProcessInstanceId = null;
|
||||||
}
|
this.activitiprocesslist.reload();
|
||||||
|
}
|
||||||
changeTab(origin: string, destination: string) {
|
|
||||||
this.tabMain.nativeElement.children[origin].classList.remove('is-active');
|
changeTab(origin: string, destination: string) {
|
||||||
this.tabMain.nativeElement.children[destination].classList.add('is-active');
|
this.tabMain.nativeElement.children[origin].classList.remove('is-active');
|
||||||
|
this.tabMain.nativeElement.children[destination].classList.add('is-active');
|
||||||
this.tabHeader.nativeElement.children[`${origin}-header`].classList.remove('is-active');
|
|
||||||
this.tabHeader.nativeElement.children[`${destination}-header`].classList.add('is-active');
|
this.tabHeader.nativeElement.children[`${origin}-header`].classList.remove('is-active');
|
||||||
}
|
this.tabHeader.nativeElement.children[`${destination}-header`].classList.add('is-active');
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
@NgModule({
|
|
||||||
imports: [
|
@NgModule({
|
||||||
BrowserModule,
|
imports: [
|
||||||
CoreModule.forRoot(),
|
BrowserModule,
|
||||||
ActivitiProcessListModule,
|
CoreModule.forRoot(),
|
||||||
ActivitiTaskListModule.forRoot()
|
ActivitiProcessListModule,
|
||||||
],
|
ActivitiTaskListModule.forRoot()
|
||||||
declarations: [MyDemoApp],
|
],
|
||||||
bootstrap: [MyDemoApp]
|
declarations: [MyDemoApp],
|
||||||
})
|
bootstrap: [MyDemoApp]
|
||||||
export class AppModule {
|
})
|
||||||
}
|
export class AppModule {
|
||||||
|
}
|
||||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
|
||||||
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
|
@ -44,7 +44,7 @@ describe('ActivitiFilters', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
activitiService = new ActivitiProcessService(null);
|
activitiService = new ActivitiProcessService(null);
|
||||||
filterList = new ActivitiProcessFilters(null, activitiService);
|
filterList = new ActivitiProcessFilters(null, activitiService, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the filter task list', (done) => {
|
it('should return the filter task list', (done) => {
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Output, EventEmitter, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, Output, EventEmitter, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
|
||||||
import { ActivitiProcessService } from './../services/activiti-process.service';
|
|
||||||
import { FilterRepresentationModel } from 'ng2-activiti-tasklist';
|
|
||||||
import { Observable, Observer } from 'rxjs/Rx';
|
import { Observable, Observer } from 'rxjs/Rx';
|
||||||
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
|
import { FilterRepresentationModel } from 'ng2-activiti-tasklist';
|
||||||
|
import { ActivitiProcessService } from './../services/activiti-process.service';
|
||||||
|
|
||||||
declare let componentHandler: any;
|
declare let componentHandler: any;
|
||||||
|
|
||||||
@ -53,8 +53,9 @@ export class ActivitiProcessFilters implements OnInit, OnChanges {
|
|||||||
|
|
||||||
filters: FilterRepresentationModel [] = [];
|
filters: FilterRepresentationModel [] = [];
|
||||||
|
|
||||||
constructor(private translate: AlfrescoTranslationService,
|
constructor(private translate: AlfrescoTranslateService,
|
||||||
private activiti: ActivitiProcessService) {
|
private activiti: ActivitiProcessService,
|
||||||
|
private logService: LogService) {
|
||||||
this.filter$ = new Observable<FilterRepresentationModel>(observer => this.filterObserver = observer).share();
|
this.filter$ = new Observable<FilterRepresentationModel>(observer => this.filterObserver = observer).share();
|
||||||
|
|
||||||
if (translate) {
|
if (translate) {
|
||||||
@ -111,7 +112,7 @@ export class ActivitiProcessFilters implements OnInit, OnChanges {
|
|||||||
this.onSuccess.emit(res);
|
this.onSuccess.emit(res);
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
this.onError.emit(err);
|
this.onError.emit(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -128,7 +129,7 @@ export class ActivitiProcessFilters implements OnInit, OnChanges {
|
|||||||
this.selectFirstFilter();
|
this.selectFirstFilter();
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
this.onError.emit(err);
|
this.onError.emit(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
|
||||||
import { AlfrescoTranslationService, CoreModule } from 'ng2-alfresco-core';
|
import { AlfrescoTranslateService, CoreModule } from 'ng2-alfresco-core';
|
||||||
import { ActivitiFormModule, FormModel, FormService } from 'ng2-activiti-form';
|
import { ActivitiFormModule, FormModel, FormService } from 'ng2-activiti-form';
|
||||||
import { ActivitiTaskListModule } from 'ng2-activiti-tasklist';
|
import { ActivitiTaskListModule } from 'ng2-activiti-tasklist';
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ describe('ActivitiProcessInstanceDetails', () => {
|
|||||||
ActivitiProcessInstanceDetails
|
ActivitiProcessInstanceDetails
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: AlfrescoTranslationService, useClass: TranslationMock },
|
{ provide: AlfrescoTranslateService, useClass: TranslationMock },
|
||||||
ActivitiProcessService
|
ActivitiProcessService
|
||||||
],
|
],
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, ViewChild, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, Input, ViewChild, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { ActivitiProcessService } from './../services/activiti-process.service';
|
import { ActivitiProcessService } from './../services/activiti-process.service';
|
||||||
import { ActivitiProcessInstanceHeader } from './activiti-process-instance-header.component';
|
import { ActivitiProcessInstanceHeader } from './activiti-process-instance-header.component';
|
||||||
import { ActivitiProcessInstanceTasks } from './activiti-process-instance-tasks.component';
|
import { ActivitiProcessInstanceTasks } from './activiti-process-instance-tasks.component';
|
||||||
@ -60,8 +60,9 @@ export class ActivitiProcessInstanceDetails implements OnChanges {
|
|||||||
* @param translate Translation service
|
* @param translate Translation service
|
||||||
* @param activitiProcess Process service
|
* @param activitiProcess Process service
|
||||||
*/
|
*/
|
||||||
constructor(private translate: AlfrescoTranslationService,
|
constructor(private translate: AlfrescoTranslateService,
|
||||||
private activitiProcess: ActivitiProcessService) {
|
private activitiProcess: ActivitiProcessService,
|
||||||
|
private logService: LogService) {
|
||||||
|
|
||||||
if (translate) {
|
if (translate) {
|
||||||
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
|
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
|
||||||
@ -110,7 +111,7 @@ export class ActivitiProcessInstanceDetails implements OnChanges {
|
|||||||
(data) => {
|
(data) => {
|
||||||
this.processCancelled.emit(data);
|
this.processCancelled.emit(data);
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
console.error(err);
|
this.logService.error(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { ProcessInstance } from '../models/process-instance.model';
|
import { ProcessInstance } from '../models/process-instance.model';
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
|
|
||||||
@ -36,7 +36,8 @@ export class ActivitiProcessInstanceHeader {
|
|||||||
@Output()
|
@Output()
|
||||||
onError: EventEmitter<any> = new EventEmitter<any>();
|
onError: EventEmitter<any> = new EventEmitter<any>();
|
||||||
|
|
||||||
constructor(private translate: AlfrescoTranslationService) {
|
constructor(private translate: AlfrescoTranslateService,
|
||||||
|
private logService: LogService) {
|
||||||
|
|
||||||
if (translate) {
|
if (translate) {
|
||||||
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
|
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
|
||||||
@ -57,7 +58,7 @@ export class ActivitiProcessInstanceHeader {
|
|||||||
try {
|
try {
|
||||||
return datePipe.transform(value, format);
|
return datePipe.transform(value, format);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`ProcessListInstanceHeader: error parsing date ${value} to format ${format}`);
|
this.logService.error(`ProcessListInstanceHeader: error parsing date ${value} to format ${format}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, OnInit, ViewChild, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, Input, OnInit, ViewChild, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
import { DatePipe } from '@angular/common';
|
||||||
|
import { Observable, Observer } from 'rxjs/Rx';
|
||||||
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { ActivitiProcessService } from './../services/activiti-process.service';
|
import { ActivitiProcessService } from './../services/activiti-process.service';
|
||||||
import { TaskDetailsModel } from 'ng2-activiti-tasklist';
|
import { TaskDetailsModel } from 'ng2-activiti-tasklist';
|
||||||
import { Observable, Observer } from 'rxjs/Rx';
|
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { ProcessInstance } from '../models/process-instance.model';
|
import { ProcessInstance } from '../models/process-instance.model';
|
||||||
|
|
||||||
declare let componentHandler: any;
|
declare let componentHandler: any;
|
||||||
@ -67,8 +67,9 @@ export class ActivitiProcessInstanceTasks implements OnInit, OnChanges {
|
|||||||
@ViewChild('taskdetails')
|
@ViewChild('taskdetails')
|
||||||
taskdetails: any;
|
taskdetails: any;
|
||||||
|
|
||||||
constructor(private translate: AlfrescoTranslationService,
|
constructor(private translate: AlfrescoTranslateService,
|
||||||
private activitiProcess: ActivitiProcessService) {
|
private activitiProcess: ActivitiProcessService,
|
||||||
|
private logService: LogService) {
|
||||||
if (translate) {
|
if (translate) {
|
||||||
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
|
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
|
||||||
}
|
}
|
||||||
@ -108,7 +109,7 @@ export class ActivitiProcessInstanceTasks implements OnInit, OnChanges {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -126,7 +127,7 @@ export class ActivitiProcessInstanceTasks implements OnInit, OnChanges {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -152,7 +153,7 @@ export class ActivitiProcessInstanceTasks implements OnInit, OnChanges {
|
|||||||
try {
|
try {
|
||||||
return datePipe.transform(value, format);
|
return datePipe.transform(value, format);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`ProcessListInstanceTask: error parsing date ${value} to format ${format}`);
|
this.logService.error(`ProcessListInstanceTask: error parsing date ${value} to format ${format}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import {
|
|||||||
ActivitiApps,
|
ActivitiApps,
|
||||||
ActivitiTaskList
|
ActivitiTaskList
|
||||||
} from 'ng2-activiti-tasklist';
|
} from 'ng2-activiti-tasklist';
|
||||||
import { CoreModule } from 'ng2-alfresco-core';
|
import { CoreModule, LogService } from 'ng2-alfresco-core';
|
||||||
import { AuthService, SettingsService, StorageService } from 'ng2-alfresco-core';
|
import { AuthService, SettingsService, StorageService } from 'ng2-alfresco-core';
|
||||||
import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
||||||
|
|
||||||
@ -146,7 +146,8 @@ class MyDemoApp implements OnInit {
|
|||||||
|
|
||||||
constructor(private authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService,
|
||||||
|
private logService: LogService) {
|
||||||
settingsService.bpmHost = this.host;
|
settingsService.bpmHost = this.host;
|
||||||
settingsService.setProviders('BPM');
|
settingsService.setProviders('BPM');
|
||||||
|
|
||||||
@ -179,12 +180,12 @@ class MyDemoApp implements OnInit {
|
|||||||
login() {
|
login() {
|
||||||
this.authService.login('admin', 'admin').subscribe(
|
this.authService.login('admin', 'admin').subscribe(
|
||||||
ticket => {
|
ticket => {
|
||||||
console.log(ticket);
|
this.logService.info(ticket);
|
||||||
this.ticket = this.authService.getTicketBpm();
|
this.ticket = this.authService.getTicketBpm();
|
||||||
this.authenticated = true;
|
this.authenticated = true;
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log(error);
|
this.logService.error(error);
|
||||||
this.authenticated = false;
|
this.authenticated = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, OnInit, ViewChild, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, Input, OnInit, ViewChild, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
import { Observer, Observable } from 'rxjs/Rx';
|
||||||
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
import { TaskDetailsModel } from '../models/task-details.model';
|
||||||
import { Observer, Observable } from 'rxjs/Rx';
|
|
||||||
|
|
||||||
declare let dialogPolyfill: any;
|
declare let dialogPolyfill: any;
|
||||||
|
|
||||||
@ -54,7 +54,8 @@ export class ActivitiChecklist implements OnInit, OnChanges {
|
|||||||
* @param translate
|
* @param translate
|
||||||
*/
|
*/
|
||||||
constructor(private translateService: AlfrescoTranslateService,
|
constructor(private translateService: AlfrescoTranslateService,
|
||||||
private activitiTaskList: ActivitiTaskListService) {
|
private activitiTaskList: ActivitiTaskListService,
|
||||||
|
private logService: LogService) {
|
||||||
|
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
translateService.addTranslationFolder('ng2-activiti-tasklist', 'node_modules/ng2-activiti-tasklist/src');
|
translateService.addTranslationFolder('ng2-activiti-tasklist', 'node_modules/ng2-activiti-tasklist/src');
|
||||||
@ -86,7 +87,7 @@ export class ActivitiChecklist implements OnInit, OnChanges {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -110,7 +111,7 @@ export class ActivitiChecklist implements OnInit, OnChanges {
|
|||||||
this.checklist.push(res);
|
this.checklist.push(res);
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import { FilterRepresentationModel } from '../models/filter.model';
|
|||||||
describe('ActivitiFilters', () => {
|
describe('ActivitiFilters', () => {
|
||||||
|
|
||||||
let filterList: ActivitiFilters;
|
let filterList: ActivitiFilters;
|
||||||
|
let activitiService: ActivitiTaskListService;
|
||||||
|
|
||||||
let fakeGlobalFilter = [];
|
let fakeGlobalFilter = [];
|
||||||
fakeGlobalFilter.push(new FilterRepresentationModel({name: 'FakeInvolvedTasks', filter: { state: 'open', assignment: 'fake-involved'}}));
|
fakeGlobalFilter.push(new FilterRepresentationModel({name: 'FakeInvolvedTasks', filter: { state: 'open', assignment: 'fake-involved'}}));
|
||||||
@ -42,12 +43,12 @@ describe('ActivitiFilters', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
let activitiService = new ActivitiTaskListService(null);
|
activitiService = new ActivitiTaskListService(null, null);
|
||||||
filterList = new ActivitiFilters(null, activitiService);
|
filterList = new ActivitiFilters(null, activitiService, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the filter task list', (done) => {
|
it('should return the filter task list', (done) => {
|
||||||
spyOn(filterList.activiti, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
|
spyOn(activitiService, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
|
||||||
const appId = '1';
|
const appId = '1';
|
||||||
let change = new SimpleChange(null, appId);
|
let change = new SimpleChange(null, appId);
|
||||||
filterList.ngOnChanges({ 'appId': change });
|
filterList.ngOnChanges({ 'appId': change });
|
||||||
@ -70,14 +71,14 @@ describe('ActivitiFilters', () => {
|
|||||||
resolve({});
|
resolve({});
|
||||||
});
|
});
|
||||||
|
|
||||||
spyOn(filterList.activiti, 'getDeployedApplications').and.returnValue(Observable.fromPromise(fakeDeployedApplicationsPromise));
|
spyOn(activitiService, 'getDeployedApplications').and.returnValue(Observable.fromPromise(fakeDeployedApplicationsPromise));
|
||||||
spyOn(filterList.activiti, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
|
spyOn(activitiService, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
|
||||||
|
|
||||||
let change = new SimpleChange(null, 'test');
|
let change = new SimpleChange(null, 'test');
|
||||||
filterList.ngOnChanges({ 'appName': change });
|
filterList.ngOnChanges({ 'appName': change });
|
||||||
|
|
||||||
filterList.onSuccess.subscribe((res) => {
|
filterList.onSuccess.subscribe((res) => {
|
||||||
let deployApp: any = filterList.activiti.getDeployedApplications;
|
let deployApp: any = activitiService.getDeployedApplications;
|
||||||
expect(deployApp.calls.count()).toEqual(1);
|
expect(deployApp.calls.count()).toEqual(1);
|
||||||
expect(res).toBeDefined();
|
expect(res).toBeDefined();
|
||||||
done();
|
done();
|
||||||
@ -87,7 +88,7 @@ describe('ActivitiFilters', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should emit an error with a bad response', (done) => {
|
it('should emit an error with a bad response', (done) => {
|
||||||
spyOn(filterList.activiti, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeErrorFilterPromise));
|
spyOn(activitiService, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeErrorFilterPromise));
|
||||||
|
|
||||||
const appId = '1';
|
const appId = '1';
|
||||||
let change = new SimpleChange(null, appId);
|
let change = new SimpleChange(null, appId);
|
||||||
@ -102,7 +103,7 @@ describe('ActivitiFilters', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should emit an error with a bad response', (done) => {
|
it('should emit an error with a bad response', (done) => {
|
||||||
spyOn(filterList.activiti, 'getDeployedApplications').and.returnValue(Observable.fromPromise(fakeErrorFilterPromise));
|
spyOn(activitiService, 'getDeployedApplications').and.returnValue(Observable.fromPromise(fakeErrorFilterPromise));
|
||||||
|
|
||||||
const appId = 'fake-app';
|
const appId = 'fake-app';
|
||||||
let change = new SimpleChange(null, appId);
|
let change = new SimpleChange(null, appId);
|
||||||
|
@ -16,11 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Output, EventEmitter, OnInit, Input, SimpleChanges, OnChanges } from '@angular/core';
|
import { Component, Output, EventEmitter, OnInit, Input, SimpleChanges, OnChanges } from '@angular/core';
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
import { Observer, Observable } from 'rxjs/Rx';
|
||||||
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
||||||
import { FilterRepresentationModel } from '../models/filter.model';
|
import { FilterRepresentationModel } from '../models/filter.model';
|
||||||
import { Observer } from 'rxjs/Observer';
|
|
||||||
import { Observable } from 'rxjs/Observable';
|
|
||||||
|
|
||||||
declare let componentHandler: any;
|
declare let componentHandler: any;
|
||||||
|
|
||||||
@ -56,7 +55,8 @@ export class ActivitiFilters implements OnInit, OnChanges {
|
|||||||
filters: FilterRepresentationModel [] = [];
|
filters: FilterRepresentationModel [] = [];
|
||||||
|
|
||||||
constructor(private translateService: AlfrescoTranslateService,
|
constructor(private translateService: AlfrescoTranslateService,
|
||||||
public activiti: ActivitiTaskListService) {
|
private activiti: ActivitiTaskListService,
|
||||||
|
private logService: LogService) {
|
||||||
this.filter$ = new Observable<FilterRepresentationModel>(observer => this.filterObserver = observer).share();
|
this.filter$ = new Observable<FilterRepresentationModel>(observer => this.filterObserver = observer).share();
|
||||||
|
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
@ -113,7 +113,7 @@ export class ActivitiFilters implements OnInit, OnChanges {
|
|||||||
this.onSuccess.emit(res);
|
this.onSuccess.emit(res);
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
this.onError.emit(err);
|
this.onError.emit(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -130,7 +130,7 @@ export class ActivitiFilters implements OnInit, OnChanges {
|
|||||||
this.selectFirstFilter();
|
this.selectFirstFilter();
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
this.onError.emit(err);
|
this.onError.emit(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { CoreModule, AlfrescoTranslateService } from 'ng2-alfresco-core';
|
import { CoreModule, AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { ActivitiPeopleService } from '../services/activiti-people.service';
|
import { ActivitiPeopleService } from '../services/activiti-people.service';
|
||||||
import { ActivitiPeople } from './activiti-people.component';
|
import { ActivitiPeople } from './activiti-people.component';
|
||||||
import { ActivitiPeopleSearch } from './activiti-people-search.component';
|
import { ActivitiPeopleSearch } from './activiti-people-search.component';
|
||||||
@ -45,6 +45,7 @@ describe('ActivitiPeople', () => {
|
|||||||
let fixture: ComponentFixture<ActivitiPeople>;
|
let fixture: ComponentFixture<ActivitiPeople>;
|
||||||
let element: HTMLElement;
|
let element: HTMLElement;
|
||||||
let componentHandler;
|
let componentHandler;
|
||||||
|
let logService: LogService;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@ -59,6 +60,8 @@ describe('ActivitiPeople', () => {
|
|||||||
ActivitiPeopleService
|
ActivitiPeopleService
|
||||||
]
|
]
|
||||||
}).compileComponents().then(() => {
|
}).compileComponents().then(() => {
|
||||||
|
logService = TestBed.get(LogService);
|
||||||
|
|
||||||
let translateService = TestBed.get(AlfrescoTranslateService);
|
let translateService = TestBed.get(AlfrescoTranslateService);
|
||||||
spyOn(translateService, 'addTranslationFolder').and.stub();
|
spyOn(translateService, 'addTranslationFolder').and.stub();
|
||||||
spyOn(translateService, 'get').and.callFake((key) => { return Observable.of(key); });
|
spyOn(translateService, 'get').and.callFake((key) => { return Observable.of(key); });
|
||||||
@ -216,9 +219,8 @@ describe('ActivitiPeople', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should log error message when search fails', async(() => {
|
it('should log error message when search fails', async(() => {
|
||||||
console.log = jasmine.createSpy('log');
|
|
||||||
activitiPeopleComponent.peopleSearch$.subscribe(() => {
|
activitiPeopleComponent.peopleSearch$.subscribe(() => {
|
||||||
expect(console.log).toHaveBeenCalledWith('Could not load users');
|
expect(logService.error).toHaveBeenCalledWith('Could not load users');
|
||||||
});
|
});
|
||||||
activitiPeopleComponent.searchUser('fake-search');
|
activitiPeopleComponent.searchUser('fake-search');
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, ViewChild } from '@angular/core';
|
import { Component, Input, ViewChild } from '@angular/core';
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
|
||||||
import { User } from '../models/user.model';
|
|
||||||
import { Observer, Observable } from 'rxjs/Rx';
|
import { Observer, Observable } from 'rxjs/Rx';
|
||||||
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
|
import { User } from '../models/user.model';
|
||||||
import { ActivitiPeopleService } from '../services/activiti-people.service';
|
import { ActivitiPeopleService } from '../services/activiti-people.service';
|
||||||
|
|
||||||
declare let dialogPolyfill: any;
|
declare let dialogPolyfill: any;
|
||||||
@ -52,7 +52,8 @@ export class ActivitiPeople {
|
|||||||
* @param people service
|
* @param people service
|
||||||
*/
|
*/
|
||||||
constructor(private translateService: AlfrescoTranslateService,
|
constructor(private translateService: AlfrescoTranslateService,
|
||||||
private peopleService: ActivitiPeopleService) {
|
private peopleService: ActivitiPeopleService,
|
||||||
|
private logService: LogService) {
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
translateService.addTranslationFolder('ng2-activiti-tasklist', 'node_modules/ng2-activiti-tasklist/src');
|
translateService.addTranslationFolder('ng2-activiti-tasklist', 'node_modules/ng2-activiti-tasklist/src');
|
||||||
}
|
}
|
||||||
@ -79,14 +80,14 @@ export class ActivitiPeople {
|
|||||||
this.peopleService.getWorkflowUsers(this.taskId, searchedWord)
|
this.peopleService.getWorkflowUsers(this.taskId, searchedWord)
|
||||||
.subscribe((users) => {
|
.subscribe((users) => {
|
||||||
this.peopleSearchObserver.next(users);
|
this.peopleSearchObserver.next(users);
|
||||||
}, error => console.log('Could not load users'));
|
}, error => this.logService.error('Could not load users'));
|
||||||
}
|
}
|
||||||
|
|
||||||
involveUser(user: User) {
|
involveUser(user: User) {
|
||||||
this.peopleService.involveUserWithTask(this.taskId, user.id.toString())
|
this.peopleService.involveUserWithTask(this.taskId, user.id.toString())
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.people.push(user);
|
this.people.push(user);
|
||||||
}, error => console.error('Impossible to involve user with task'));
|
}, error => this.logService.error('Impossible to involve user with task'));
|
||||||
}
|
}
|
||||||
|
|
||||||
removeInvolvedUser(user: User) {
|
removeInvolvedUser(user: User) {
|
||||||
@ -95,7 +96,7 @@ export class ActivitiPeople {
|
|||||||
this.people = this.people.filter((involvedUser) => {
|
this.people = this.people.filter((involvedUser) => {
|
||||||
return involvedUser.id !== user.id;
|
return involvedUser.id !== user.id;
|
||||||
});
|
});
|
||||||
}, error => console.error('Impossible to remove involved user from task'));
|
}, error => this.logService.error('Impossible to remove involved user from task'));
|
||||||
}
|
}
|
||||||
|
|
||||||
getDisplayUser(user: User): string {
|
getDisplayUser(user: User): string {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
import { TaskDetailsModel } from '../models/task-details.model';
|
||||||
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
||||||
import { Form } from '../models/form.model';
|
import { Form } from '../models/form.model';
|
||||||
@ -55,7 +55,8 @@ export class ActivitiStartTaskButton {
|
|||||||
* @param taskService
|
* @param taskService
|
||||||
*/
|
*/
|
||||||
constructor(private translateService: AlfrescoTranslateService,
|
constructor(private translateService: AlfrescoTranslateService,
|
||||||
private taskService: ActivitiTaskListService) {
|
private taskService: ActivitiTaskListService,
|
||||||
|
private logService: LogService) {
|
||||||
|
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
translateService.addTranslationFolder('ng2-activiti-tasklist', 'node_modules/ng2-activiti-tasklist/src');
|
translateService.addTranslationFolder('ng2-activiti-tasklist', 'node_modules/ng2-activiti-tasklist/src');
|
||||||
@ -77,7 +78,7 @@ export class ActivitiStartTaskButton {
|
|||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
window.alert('An error occurred while trying to add the task');
|
window.alert('An error occurred while trying to add the task');
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -112,7 +113,7 @@ export class ActivitiStartTaskButton {
|
|||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
window.alert('An error occurred while trying to get the forms');
|
window.alert('An error occurred while trying to get the forms');
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,19 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import { Component, Input, OnInit, ViewChild, Output, EventEmitter, TemplateRef, OnChanges, SimpleChanges, DebugElement} from '@angular/core';
|
||||||
Component,
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
Input,
|
|
||||||
OnInit,
|
|
||||||
ViewChild,
|
|
||||||
Output,
|
|
||||||
EventEmitter,
|
|
||||||
TemplateRef,
|
|
||||||
OnChanges,
|
|
||||||
SimpleChanges,
|
|
||||||
DebugElement
|
|
||||||
} from '@angular/core';
|
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
|
||||||
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
import { TaskDetailsModel } from '../models/task-details.model';
|
||||||
import { User } from '../models/user.model';
|
import { User } from '../models/user.model';
|
||||||
@ -103,7 +92,8 @@ export class ActivitiTaskDetails implements OnInit, OnChanges {
|
|||||||
*/
|
*/
|
||||||
constructor(private translateService: AlfrescoTranslateService,
|
constructor(private translateService: AlfrescoTranslateService,
|
||||||
private activitiForm: FormService,
|
private activitiForm: FormService,
|
||||||
private activitiTaskList: ActivitiTaskListService) {
|
private activitiTaskList: ActivitiTaskListService,
|
||||||
|
private logService: LogService) {
|
||||||
|
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
translateService.addTranslationFolder('ng2-activiti-tasklist', 'node_modules/ng2-activiti-tasklist/src');
|
translateService.addTranslationFolder('ng2-activiti-tasklist', 'node_modules/ng2-activiti-tasklist/src');
|
||||||
@ -201,7 +191,7 @@ export class ActivitiTaskDetails implements OnInit, OnChanges {
|
|||||||
this.reset();
|
this.reset();
|
||||||
}
|
}
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
this.onError.emit(error);
|
this.onError.emit(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
import { TaskDetailsModel } from '../models/task-details.model';
|
||||||
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
||||||
|
|
||||||
@ -38,7 +38,8 @@ export class ActivitiTaskHeader {
|
|||||||
claim: EventEmitter<any> = new EventEmitter<any>();
|
claim: EventEmitter<any> = new EventEmitter<any>();
|
||||||
|
|
||||||
constructor(private translateService: AlfrescoTranslateService,
|
constructor(private translateService: AlfrescoTranslateService,
|
||||||
private activitiTaskService: ActivitiTaskListService) {
|
private activitiTaskService: ActivitiTaskListService,
|
||||||
|
private logService: LogService) {
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
translateService.addTranslationFolder('ng2-activiti-tasklist', 'node_modules/ng2-activiti-tasklist/src');
|
translateService.addTranslationFolder('ng2-activiti-tasklist', 'node_modules/ng2-activiti-tasklist/src');
|
||||||
}
|
}
|
||||||
@ -55,7 +56,7 @@ export class ActivitiTaskHeader {
|
|||||||
claimTask(taskId: string) {
|
claimTask(taskId: string) {
|
||||||
this.activitiTaskService.claimTask(taskId).subscribe(
|
this.activitiTaskService.claimTask(taskId).subscribe(
|
||||||
(res: any) => {
|
(res: any) => {
|
||||||
console.log('Task claimed');
|
this.logService.info('Task claimed');
|
||||||
this.claim.emit(taskId);
|
this.claim.emit(taskId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { ObjectDataTableAdapter, DataTableAdapter, DataRowEvent, ObjectDataRow } from 'ng2-alfresco-datatable';
|
import { ObjectDataTableAdapter, DataTableAdapter, DataRowEvent, ObjectDataRow } from 'ng2-alfresco-datatable';
|
||||||
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
||||||
import { TaskQueryRequestRepresentationModel } from '../models/filter.model';
|
import { TaskQueryRequestRepresentationModel } from '../models/filter.model';
|
||||||
@ -73,7 +73,8 @@ export class ActivitiTaskList implements OnInit, OnChanges {
|
|||||||
];
|
];
|
||||||
|
|
||||||
constructor(private translateService: AlfrescoTranslateService,
|
constructor(private translateService: AlfrescoTranslateService,
|
||||||
private taskListService: ActivitiTaskListService) {
|
private taskListService: ActivitiTaskListService,
|
||||||
|
private logService: LogService) {
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
translateService.addTranslationFolder('ng2-activiti-tasklist', 'node_modules/ng2-activiti-tasklist/src');
|
translateService.addTranslationFolder('ng2-activiti-tasklist', 'node_modules/ng2-activiti-tasklist/src');
|
||||||
}
|
}
|
||||||
@ -144,11 +145,11 @@ export class ActivitiTaskList implements OnInit, OnChanges {
|
|||||||
this.selectFirst();
|
this.selectFirst();
|
||||||
this.onSuccess.emit(response);
|
this.onSuccess.emit(response);
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
this.onError.emit(error);
|
this.onError.emit(error);
|
||||||
});
|
});
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
console.error(err);
|
this.logService.error(err);
|
||||||
this.onError.emit(err);
|
this.onError.emit(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ describe('NoTaskDetailsTemplateComponent', () => {
|
|||||||
let detailsComponent: ActivitiTaskDetails;
|
let detailsComponent: ActivitiTaskDetails;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
detailsComponent = new ActivitiTaskDetails(null, null, null);
|
detailsComponent = new ActivitiTaskDetails(null, null, null, null);
|
||||||
component = new NoTaskDetailsTemplateComponent(detailsComponent);
|
component = new NoTaskDetailsTemplateComponent(detailsComponent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
import { AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { Response } from '@angular/http';
|
import { Response } from '@angular/http';
|
||||||
import { User } from '../models/user.model';
|
import { User } from '../models/user.model';
|
||||||
@ -24,7 +24,8 @@ import { User } from '../models/user.model';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class ActivitiPeopleService {
|
export class ActivitiPeopleService {
|
||||||
|
|
||||||
constructor(private alfrescoJsApi: AlfrescoApiService) {
|
constructor(private alfrescoJsApi: AlfrescoApiService,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
getWorkflowUsers(taskId: string, searchWord: string): Observable<User[]> {
|
getWorkflowUsers(taskId: string, searchWord: string): Observable<User[]> {
|
||||||
@ -64,9 +65,7 @@ export class ActivitiPeopleService {
|
|||||||
* @returns {ErrorObservable}
|
* @returns {ErrorObservable}
|
||||||
*/
|
*/
|
||||||
private handleError(error: Response) {
|
private handleError(error: Response) {
|
||||||
// in a real world app, we may send the error to some remote logging infrastructure
|
this.logService.error(error);
|
||||||
// instead of just logging it to the console
|
|
||||||
console.error(error);
|
|
||||||
return Observable.throw(error || 'Server error');
|
return Observable.throw(error || 'Server error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
import { AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||||
import { FilterRepresentationModel, TaskQueryRequestRepresentationModel } from '../models/filter.model';
|
import { FilterRepresentationModel, TaskQueryRequestRepresentationModel } from '../models/filter.model';
|
||||||
import { Comment } from '../models/comment.model';
|
import { Comment } from '../models/comment.model';
|
||||||
import { User } from '../models/user.model';
|
import { User } from '../models/user.model';
|
||||||
@ -27,7 +27,8 @@ import { Form } from '../models/form.model';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class ActivitiTaskListService {
|
export class ActivitiTaskListService {
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService) {
|
constructor(private apiService: AlfrescoApiService,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -311,7 +312,7 @@ export class ActivitiTaskListService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleError(error: any) {
|
private handleError(error: any) {
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
return Observable.throw(error || 'Server error');
|
return Observable.throw(error || 'Server error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ import {
|
|||||||
AuthGuard,
|
AuthGuard,
|
||||||
AuthGuardEcm,
|
AuthGuardEcm,
|
||||||
AuthGuardBpm,
|
AuthGuardBpm,
|
||||||
LogService,
|
LogService, LogServiceMock,
|
||||||
|
|
||||||
/** @deprecated */ AlfrescoSettingsService,
|
/** @deprecated */ AlfrescoSettingsService,
|
||||||
/** @deprecated */ AlfrescoTranslationService,
|
/** @deprecated */ AlfrescoTranslationService,
|
||||||
@ -49,7 +49,7 @@ export * from './src/components/index';
|
|||||||
export * from './src/utils/index';
|
export * from './src/utils/index';
|
||||||
|
|
||||||
export const ALFRESCO_CORE_PROVIDERS: any[] = [
|
export const ALFRESCO_CORE_PROVIDERS: any[] = [
|
||||||
LogService,
|
LogService, LogServiceMock,
|
||||||
AuthService,
|
AuthService,
|
||||||
ContentService,
|
ContentService,
|
||||||
SettingsService,
|
SettingsService,
|
||||||
@ -69,8 +69,8 @@ export const ALFRESCO_CORE_PROVIDERS: any[] = [
|
|||||||
/** @deprecated */ AlfrescoTranslationService
|
/** @deprecated */ AlfrescoTranslationService
|
||||||
];
|
];
|
||||||
|
|
||||||
export function createTranslateLoader(http: Http) {
|
export function createTranslateLoader(http: Http, logService: LogService) {
|
||||||
return new AlfrescoTranslateLoader(http);
|
return new AlfrescoTranslateLoader(http, logService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@ -82,7 +82,7 @@ export function createTranslateLoader(http: Http) {
|
|||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useFactory: (createTranslateLoader),
|
useFactory: (createTranslateLoader),
|
||||||
deps: [Http]
|
deps: [Http, LogService]
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { LogService } from './log.service';
|
||||||
import { SettingsService } from './settings.service';
|
import { SettingsService } from './settings.service';
|
||||||
import { StorageService } from './storage.service';
|
import { StorageService } from './storage.service';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
@ -26,8 +27,9 @@ import { AuthService } from './auth.service';
|
|||||||
export class AlfrescoAuthenticationService extends AuthService {
|
export class AlfrescoAuthenticationService extends AuthService {
|
||||||
constructor(settingsService: SettingsService,
|
constructor(settingsService: SettingsService,
|
||||||
apiService: AlfrescoApiService,
|
apiService: AlfrescoApiService,
|
||||||
storage: StorageService) {
|
storage: StorageService,
|
||||||
super(settingsService, apiService, storage);
|
logService: LogService) {
|
||||||
console.log('Warning: AlfrescoAuthenticationService is deprecated. Use AuthService instead.');
|
super(settingsService, apiService, storage, logService);
|
||||||
|
logService.warn('Warning: AlfrescoAuthenticationService is deprecated. Use AuthService instead.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { LogService } from './log.service';
|
||||||
import { AuthService } from './auth.service';
|
import { AuthService } from './auth.service';
|
||||||
import { ContentService } from './content.service';
|
import { ContentService } from './content.service';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
@ -25,8 +25,10 @@ import { AlfrescoApiService } from './alfresco-api.service';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class AlfrescoContentService extends ContentService {
|
export class AlfrescoContentService extends ContentService {
|
||||||
|
|
||||||
constructor(authService: AuthService, apiService: AlfrescoApiService) {
|
constructor(authService: AuthService,
|
||||||
|
apiService: AlfrescoApiService,
|
||||||
|
logService: LogService) {
|
||||||
super(authService, apiService);
|
super(authService, apiService);
|
||||||
console.log('Warning: AlfrescoContentService is deprecated. Use ContentService instead.');
|
logService.warn('Warning: AlfrescoContentService is deprecated. Use ContentService instead.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,14 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { SettingsService } from './settings.service';
|
import { SettingsService } from './settings.service';
|
||||||
|
import { LogService } from './log.service';
|
||||||
|
|
||||||
/** @deprecated AlfrescoSettingsService is deprecated. Use SettingsService instead */
|
/** @deprecated AlfrescoSettingsService is deprecated. Use SettingsService instead */
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AlfrescoSettingsService extends SettingsService {
|
export class AlfrescoSettingsService extends SettingsService {
|
||||||
|
|
||||||
constructor() {
|
constructor(logService: LogService) {
|
||||||
super();
|
super();
|
||||||
console.log('Warning: AlfrescoSettingsService is deprecated. Use SettingsService instead.');
|
logService.warn('Warning: AlfrescoSettingsService is deprecated. Use SettingsService instead.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,16 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { TranslateService } from 'ng2-translate/ng2-translate';
|
import { TranslateService } from 'ng2-translate/ng2-translate';
|
||||||
import { AlfrescoTranslateService } from './translate.service';
|
import { AlfrescoTranslateService } from './translate.service';
|
||||||
|
import { LogService } from './log.service';
|
||||||
|
|
||||||
/** @deprecated AlfrescoTranslationService is deprecated. Use AlfrescoTranslateService instead */
|
/** @deprecated AlfrescoTranslationService is deprecated. Use AlfrescoTranslateService instead */
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AlfrescoTranslationService extends AlfrescoTranslateService {
|
export class AlfrescoTranslationService extends AlfrescoTranslateService {
|
||||||
|
|
||||||
constructor(translate: TranslateService) {
|
constructor(translate: TranslateService,
|
||||||
|
logService: LogService) {
|
||||||
super(translate);
|
super(translate);
|
||||||
console.log('Warning: AlfrescoTranslationService is deprecated. Use AlfrescoTranslateService instead.');
|
logService.warn('Warning: AlfrescoTranslationService is deprecated. Use AlfrescoTranslateService instead.');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import { SettingsService } from './settings.service';
|
|||||||
import { AuthService } from './auth.service';
|
import { AuthService } from './auth.service';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
import { StorageService } from './storage.service';
|
import { StorageService } from './storage.service';
|
||||||
|
import { LogService } from './log.service';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
@ -34,7 +35,8 @@ describe('AuthService', () => {
|
|||||||
SettingsService,
|
SettingsService,
|
||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
AuthService,
|
AuthService,
|
||||||
StorageService
|
StorageService,
|
||||||
|
LogService
|
||||||
]);
|
]);
|
||||||
|
|
||||||
authService = injector.get(AuthService);
|
authService = injector.get(AuthService);
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable, Subject } from 'rxjs/Rx';
|
||||||
import { SettingsService } from './settings.service';
|
import { SettingsService } from './settings.service';
|
||||||
import { StorageService } from './storage.service';
|
import { StorageService } from './storage.service';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
import * as alfrescoApi from 'alfresco-js-api';
|
import * as alfrescoApi from 'alfresco-js-api';
|
||||||
import { AlfrescoApi } from 'alfresco-js-api';
|
import { AlfrescoApi } from 'alfresco-js-api';
|
||||||
import { Subject } from 'rxjs/Subject';
|
import { LogService } from './log.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
@ -33,7 +33,8 @@ export class AuthService {
|
|||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private apiService: AlfrescoApiService,
|
private apiService: AlfrescoApiService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService,
|
||||||
|
private logService: LogService) {
|
||||||
this.alfrescoApi = <AlfrescoApi>new alfrescoApi({
|
this.alfrescoApi = <AlfrescoApi>new alfrescoApi({
|
||||||
provider: this.settingsService.getProviders(),
|
provider: this.settingsService.getProviders(),
|
||||||
ticketEcm: this.getTicketEcm(),
|
ticketEcm: this.getTicketEcm(),
|
||||||
@ -103,7 +104,7 @@ export class AuthService {
|
|||||||
*
|
*
|
||||||
* @returns {Observable<R>|Observable<T>}
|
* @returns {Observable<R>|Observable<T>}
|
||||||
*/
|
*/
|
||||||
public logout() {
|
logout() {
|
||||||
return Observable.fromPromise(this.callApiLogout())
|
return Observable.fromPromise(this.callApiLogout())
|
||||||
.map(res => <any> res)
|
.map(res => <any> res)
|
||||||
.do(response => {
|
.do(response => {
|
||||||
@ -127,7 +128,7 @@ export class AuthService {
|
|||||||
/**
|
/**
|
||||||
* Remove the login ticket from Storage
|
* Remove the login ticket from Storage
|
||||||
*/
|
*/
|
||||||
public removeTicket(): void {
|
removeTicket(): void {
|
||||||
this.storage.removeItem('ticket-ECM');
|
this.storage.removeItem('ticket-ECM');
|
||||||
this.storage.removeItem('ticket-BPM');
|
this.storage.removeItem('ticket-BPM');
|
||||||
this.alfrescoApi.setTicket(undefined, undefined);
|
this.alfrescoApi.setTicket(undefined, undefined);
|
||||||
@ -137,7 +138,7 @@ export class AuthService {
|
|||||||
* The method return the ECM ticket stored in the Storage
|
* The method return the ECM ticket stored in the Storage
|
||||||
* @returns ticket
|
* @returns ticket
|
||||||
*/
|
*/
|
||||||
public getTicketEcm(): string | null {
|
getTicketEcm(): string | null {
|
||||||
return this.storage.getItem('ticket-ECM');
|
return this.storage.getItem('ticket-ECM');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,11 +146,11 @@ export class AuthService {
|
|||||||
* The method return the BPM ticket stored in the Storage
|
* The method return the BPM ticket stored in the Storage
|
||||||
* @returns ticket
|
* @returns ticket
|
||||||
*/
|
*/
|
||||||
public getTicketBpm(): string | null {
|
getTicketBpm(): string | null {
|
||||||
return this.storage.getItem('ticket-BPM');
|
return this.storage.getItem('ticket-BPM');
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTicketEcmBase64(): string | null {
|
getTicketEcmBase64(): string | null {
|
||||||
let ticket = this.storage.getItem('ticket-ECM');
|
let ticket = this.storage.getItem('ticket-ECM');
|
||||||
if (ticket) {
|
if (ticket) {
|
||||||
return 'Basic ' + btoa(ticket);
|
return 'Basic ' + btoa(ticket);
|
||||||
@ -160,7 +161,7 @@ export class AuthService {
|
|||||||
/**
|
/**
|
||||||
* The method save the ECM and BPM ticket in the Storage
|
* The method save the ECM and BPM ticket in the Storage
|
||||||
*/
|
*/
|
||||||
public saveTickets() {
|
saveTickets() {
|
||||||
this.saveTicketEcm();
|
this.saveTicketEcm();
|
||||||
this.saveTicketBpm();
|
this.saveTicketBpm();
|
||||||
}
|
}
|
||||||
@ -168,7 +169,7 @@ export class AuthService {
|
|||||||
/**
|
/**
|
||||||
* The method save the ECM ticket in the Storage
|
* The method save the ECM ticket in the Storage
|
||||||
*/
|
*/
|
||||||
public saveTicketEcm(): void {
|
saveTicketEcm(): void {
|
||||||
if (this.alfrescoApi && this.alfrescoApi.getTicketEcm()) {
|
if (this.alfrescoApi && this.alfrescoApi.getTicketEcm()) {
|
||||||
this.storage.setItem('ticket-ECM', this.alfrescoApi.getTicketEcm());
|
this.storage.setItem('ticket-ECM', this.alfrescoApi.getTicketEcm());
|
||||||
}
|
}
|
||||||
@ -177,7 +178,7 @@ export class AuthService {
|
|||||||
/**
|
/**
|
||||||
* The method save the BPM ticket in the Storage
|
* The method save the BPM ticket in the Storage
|
||||||
*/
|
*/
|
||||||
public saveTicketBpm(): void {
|
saveTicketBpm(): void {
|
||||||
if (this.alfrescoApi && this.alfrescoApi.getTicketBpm()) {
|
if (this.alfrescoApi && this.alfrescoApi.getTicketBpm()) {
|
||||||
this.storage.setItem('ticket-BPM', this.alfrescoApi.getTicketBpm());
|
this.storage.setItem('ticket-BPM', this.alfrescoApi.getTicketBpm());
|
||||||
}
|
}
|
||||||
@ -186,14 +187,14 @@ export class AuthService {
|
|||||||
/**
|
/**
|
||||||
* The method return true if user is logged in on ecm provider
|
* The method return true if user is logged in on ecm provider
|
||||||
*/
|
*/
|
||||||
public isEcmLoggedIn() {
|
isEcmLoggedIn() {
|
||||||
return this.alfrescoApi.ecmAuth && !!this.alfrescoApi.ecmAuth.isLoggedIn();
|
return this.alfrescoApi.ecmAuth && !!this.alfrescoApi.ecmAuth.isLoggedIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The method return true if user is logged in on bpm provider
|
* The method return true if user is logged in on bpm provider
|
||||||
*/
|
*/
|
||||||
public isBpmLoggedIn() {
|
isBpmLoggedIn() {
|
||||||
return this.alfrescoApi.bpmAuth && !!this.alfrescoApi.bpmAuth.isLoggedIn();
|
return this.alfrescoApi.bpmAuth && !!this.alfrescoApi.bpmAuth.isLoggedIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,8 +203,8 @@ export class AuthService {
|
|||||||
* @param error
|
* @param error
|
||||||
* @returns {ErrorObservable}
|
* @returns {ErrorObservable}
|
||||||
*/
|
*/
|
||||||
public handleError(error: any): Observable<any> {
|
handleError(error: any): Observable<any> {
|
||||||
console.error('Error when logging in', error);
|
this.logService.error('Error when logging in', error);
|
||||||
return Observable.throw(error || 'Server error');
|
return Observable.throw(error || 'Server error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import { AuthService } from './auth.service';
|
|||||||
import { ContentService } from './content.service';
|
import { ContentService } from './content.service';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
import { StorageService } from './storage.service';
|
import { StorageService } from './storage.service';
|
||||||
|
import { LogService } from './log.service';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
@ -40,7 +41,8 @@ describe('ContentService', () => {
|
|||||||
ContentService,
|
ContentService,
|
||||||
AuthService,
|
AuthService,
|
||||||
SettingsService,
|
SettingsService,
|
||||||
StorageService
|
StorageService,
|
||||||
|
LogService
|
||||||
]);
|
]);
|
||||||
|
|
||||||
authService = injector.get(AuthService);
|
authService = injector.get(AuthService);
|
||||||
|
@ -21,7 +21,7 @@ import { Injectable } from '@angular/core';
|
|||||||
export class LogService {
|
export class LogService {
|
||||||
|
|
||||||
get assert(): (message?: any, ...optionalParams: any[]) => void {
|
get assert(): (message?: any, ...optionalParams: any[]) => void {
|
||||||
return console.error.bind(console);
|
return console.assert.bind(console);
|
||||||
}
|
}
|
||||||
|
|
||||||
get error(): (message?: any, ...optionalParams: any[]) => void {
|
get error(): (message?: any, ...optionalParams: any[]) => void {
|
||||||
@ -29,11 +29,11 @@ export class LogService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get group(): (message?: any, ...optionalParams: any[]) => void {
|
get group(): (message?: any, ...optionalParams: any[]) => void {
|
||||||
return console.error.bind(console);
|
return console.group.bind(console);
|
||||||
}
|
}
|
||||||
|
|
||||||
get groupEnd(): (message?: any, ...optionalParams: any[]) => void {
|
get groupEnd(): (message?: any, ...optionalParams: any[]) => void {
|
||||||
return console.error.bind(console);
|
return console.groupEnd.bind(console);
|
||||||
}
|
}
|
||||||
|
|
||||||
get info(): (message?: any, ...optionalParams: any[]) => void {
|
get info(): (message?: any, ...optionalParams: any[]) => void {
|
||||||
@ -49,3 +49,15 @@ export class LogService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class LogServiceMock {
|
||||||
|
|
||||||
|
assert(message?: any, ...optionalParams: any[]) {}
|
||||||
|
error(message?: any, ...optionalParams: any[]) {}
|
||||||
|
group(message?: any, ...optionalParams: any[]) {}
|
||||||
|
groupEnd(message?: any, ...optionalParams: any[]) {}
|
||||||
|
info(message?: any, ...optionalParams: any[]) {}
|
||||||
|
log(message?: any, ...optionalParams: any[]) {}
|
||||||
|
warn(message?: any, ...optionalParams: any[]) {}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -18,11 +18,8 @@
|
|||||||
import { ReflectiveInjector } from '@angular/core';
|
import { ReflectiveInjector } from '@angular/core';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
import { RenditionsService } from './renditions.service';
|
import { RenditionsService } from './renditions.service';
|
||||||
import {
|
import { LogService } from './log.service';
|
||||||
fakeRedition,
|
import { fakeRedition, fakeReditionCreated, fakeReditionsList } from '../assets/renditionsService.mock';
|
||||||
fakeReditionCreated,
|
|
||||||
fakeReditionsList
|
|
||||||
} from '../assets/renditionsService.mock';
|
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
declare let AlfrescoApi: any;
|
declare let AlfrescoApi: any;
|
||||||
@ -33,7 +30,8 @@ describe('RenditionsService', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
injector = ReflectiveInjector.resolveAndCreate([
|
injector = ReflectiveInjector.resolveAndCreate([
|
||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
RenditionsService
|
RenditionsService,
|
||||||
|
LogService
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
|
import { LogService } from './log.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RenditionsService
|
* RenditionsService
|
||||||
@ -27,7 +28,8 @@ import { AlfrescoApiService } from './alfresco-api.service';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class RenditionsService {
|
export class RenditionsService {
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService) {
|
constructor(private apiService: AlfrescoApiService,
|
||||||
|
private logService: LogService) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +77,7 @@ export class RenditionsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleError(error: any): Observable<any> {
|
private handleError(error: any): Observable<any> {
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
return Observable.throw(error || 'Server error');
|
return Observable.throw(error || 'Server error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import {getTestBed, TestBed} from '@angular/core/testing';
|
|||||||
|
|
||||||
import { AlfrescoTranslateLoader } from './translate-loader.service';
|
import { AlfrescoTranslateLoader } from './translate-loader.service';
|
||||||
import { AlfrescoTranslateService } from './translate.service';
|
import { AlfrescoTranslateService } from './translate.service';
|
||||||
|
import { LogService } from './log.service';
|
||||||
|
|
||||||
let componentJson1 = ' {"TEST": "This is a test", "TEST2": "This is another test"} ' ;
|
let componentJson1 = ' {"TEST": "This is a test", "TEST2": "This is another test"} ' ;
|
||||||
|
|
||||||
@ -39,12 +40,16 @@ describe('TranslateLoader', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [HttpModule, TranslateModule.forRoot({
|
imports: [
|
||||||
provide: TranslateLoader,
|
HttpModule,
|
||||||
useClass: AlfrescoTranslateLoader
|
TranslateModule.forRoot({
|
||||||
})],
|
provide: TranslateLoader,
|
||||||
|
useClass: AlfrescoTranslateLoader
|
||||||
|
})
|
||||||
|
],
|
||||||
providers: [
|
providers: [
|
||||||
AlfrescoTranslateService,
|
AlfrescoTranslateService,
|
||||||
|
LogService,
|
||||||
{provide: XHRBackend, useClass: MockBackend}
|
{provide: XHRBackend, useClass: MockBackend}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
@ -17,9 +17,10 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Response, Http } from '@angular/http';
|
import { Response, Http } from '@angular/http';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { TranslateLoader } from 'ng2-translate/ng2-translate';
|
import { TranslateLoader } from 'ng2-translate/ng2-translate';
|
||||||
import { ComponentTranslationModel } from '../models/component.model';
|
import { ComponentTranslationModel } from '../models/component.model';
|
||||||
|
import { LogService } from './log.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AlfrescoTranslateLoader implements TranslateLoader {
|
export class AlfrescoTranslateLoader implements TranslateLoader {
|
||||||
@ -29,7 +30,8 @@ export class AlfrescoTranslateLoader implements TranslateLoader {
|
|||||||
private _componentList: ComponentTranslationModel[] = [];
|
private _componentList: ComponentTranslationModel[] = [];
|
||||||
private queue: string [][] = [];
|
private queue: string [][] = [];
|
||||||
|
|
||||||
constructor(private http: Http) {
|
constructor(private http: Http,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
addComponentList(nameInput: string, pathInput: string) {
|
addComponentList(nameInput: string, pathInput: string) {
|
||||||
@ -95,7 +97,7 @@ export class AlfrescoTranslateLoader implements TranslateLoader {
|
|||||||
observer.complete();
|
observer.complete();
|
||||||
},
|
},
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
console.error(err);
|
this.logService.error(err);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let fullTranslation = this.getFullTranslationJSON(lang);
|
let fullTranslation = this.getFullTranslationJSON(lang);
|
||||||
|
@ -23,6 +23,7 @@ import { getTestBed, TestBed } from '@angular/core/testing';
|
|||||||
|
|
||||||
import { AlfrescoTranslateService } from './translate.service';
|
import { AlfrescoTranslateService } from './translate.service';
|
||||||
import { AlfrescoTranslateLoader } from './translate-loader.service';
|
import { AlfrescoTranslateLoader } from './translate-loader.service';
|
||||||
|
import { LogService } from './log.service';
|
||||||
|
|
||||||
const mockBackendResponse = (connection: MockConnection, response: string) => {
|
const mockBackendResponse = (connection: MockConnection, response: string) => {
|
||||||
connection.mockRespond(new Response(new ResponseOptions({body: response})));
|
connection.mockRespond(new Response(new ResponseOptions({body: response})));
|
||||||
@ -36,12 +37,16 @@ describe('AlfrescoTranslateService', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [HttpModule, TranslateModule.forRoot({
|
imports: [
|
||||||
provide: TranslateLoader,
|
HttpModule,
|
||||||
useClass: AlfrescoTranslateLoader
|
TranslateModule.forRoot({
|
||||||
})],
|
provide: TranslateLoader,
|
||||||
|
useClass: AlfrescoTranslateLoader
|
||||||
|
})
|
||||||
|
],
|
||||||
providers: [
|
providers: [
|
||||||
AlfrescoTranslateService,
|
AlfrescoTranslateService,
|
||||||
|
LogService,
|
||||||
{provide: XHRBackend, useClass: MockBackend}
|
{provide: XHRBackend, useClass: MockBackend}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
@ -17,13 +17,7 @@
|
|||||||
|
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import { ObjectUtils } from 'ng2-alfresco-core';
|
import { ObjectUtils } from 'ng2-alfresco-core';
|
||||||
|
import { DataTableAdapter, DataRow, DataColumn, DataSorting } from './datatable-adapter';
|
||||||
import {
|
|
||||||
DataTableAdapter,
|
|
||||||
DataRow,
|
|
||||||
DataColumn,
|
|
||||||
DataSorting
|
|
||||||
} from './datatable-adapter';
|
|
||||||
|
|
||||||
// Simple implementation of the DataTableAdapter interface.
|
// Simple implementation of the DataTableAdapter interface.
|
||||||
export class ObjectDataTableAdapter implements DataTableAdapter {
|
export class ObjectDataTableAdapter implements DataTableAdapter {
|
||||||
|
@ -19,7 +19,7 @@ import { NgModule, Component, OnInit, ViewChild } from '@angular/core';
|
|||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { DocumentListModule, DocumentList, DocumentActionsService } from 'ng2-alfresco-documentlist';
|
import { DocumentListModule, DocumentList, DocumentActionsService } from 'ng2-alfresco-documentlist';
|
||||||
import { CoreModule, StorageService, SettingsService, AuthService, AlfrescoTranslationService } from 'ng2-alfresco-core';
|
import { CoreModule, StorageService, SettingsService, AuthService, AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'alfresco-app-demo',
|
selector: 'alfresco-app-demo',
|
||||||
@ -129,9 +129,10 @@ class DocumentListDemo implements OnInit {
|
|||||||
|
|
||||||
constructor(private authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private translateService: AlfrescoTranslationService,
|
private translateService: AlfrescoTranslateService,
|
||||||
private documentActions: DocumentActionsService,
|
private documentActions: DocumentActionsService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService,
|
||||||
|
private logService: LogService) {
|
||||||
|
|
||||||
settingsService.ecmHost = this.ecmHost;
|
settingsService.ecmHost = this.ecmHost;
|
||||||
settingsService.setProviders('ECM');
|
settingsService.setProviders('ECM');
|
||||||
@ -174,13 +175,13 @@ class DocumentListDemo implements OnInit {
|
|||||||
login() {
|
login() {
|
||||||
this.authService.login('admin', 'admin').subscribe(
|
this.authService.login('admin', 'admin').subscribe(
|
||||||
ticket => {
|
ticket => {
|
||||||
console.log(ticket);
|
this.logService.info(ticket);
|
||||||
this.ticket = this.authService.getTicketEcm();
|
this.ticket = this.authService.getTicketEcm();
|
||||||
this.authenticated = true;
|
this.authenticated = true;
|
||||||
this.documentList.reload();
|
this.documentList.reload();
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log(error);
|
this.logService.error(error);
|
||||||
this.authenticated = false;
|
this.authenticated = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { NodePaging } from './../models/document-library.model';
|
import { NodePaging } from './../models/document-library.model';
|
||||||
import { PageNode } from './document-library.model.mock';
|
import { PageNode } from './document-library.model.mock';
|
||||||
import { DocumentListService } from './../services/document-list.service';
|
import { DocumentListService } from './../services/document-list.service';
|
||||||
@ -23,7 +23,8 @@ import {
|
|||||||
SettingsService,
|
SettingsService,
|
||||||
AuthService,
|
AuthService,
|
||||||
AlfrescoContentService,
|
AlfrescoContentService,
|
||||||
AlfrescoApiService
|
AlfrescoApiService,
|
||||||
|
LogService
|
||||||
} from 'ng2-alfresco-core';
|
} from 'ng2-alfresco-core';
|
||||||
|
|
||||||
export class DocumentListServiceMock extends DocumentListService {
|
export class DocumentListServiceMock extends DocumentListService {
|
||||||
@ -36,9 +37,10 @@ export class DocumentListServiceMock extends DocumentListService {
|
|||||||
settings?: SettingsService,
|
settings?: SettingsService,
|
||||||
authService?: AuthService,
|
authService?: AuthService,
|
||||||
contentService?: AlfrescoContentService,
|
contentService?: AlfrescoContentService,
|
||||||
apiService?: AlfrescoApiService
|
apiService?: AlfrescoApiService,
|
||||||
|
logService?: LogService,
|
||||||
) {
|
) {
|
||||||
super(authService, contentService, apiService);
|
super(authService, contentService, apiService, logService);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFolder(folder: string) {
|
getFolder(folder: string) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, Output, EventEmitter, ViewChild } from '@angular/core';
|
import { Component, Input, Output, EventEmitter, ViewChild } from '@angular/core';
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { MinimalNodeEntity } from 'alfresco-js-api';
|
import { MinimalNodeEntity } from 'alfresco-js-api';
|
||||||
import { DocumentListService } from './../services/document-list.service';
|
import { DocumentListService } from './../services/document-list.service';
|
||||||
import { ContentActionModel } from './../models/content-action.model';
|
import { ContentActionModel } from './../models/content-action.model';
|
||||||
@ -51,9 +51,9 @@ export class DocumentMenuAction {
|
|||||||
|
|
||||||
folderName: string = '';
|
folderName: string = '';
|
||||||
|
|
||||||
constructor(
|
constructor(private documentListService: DocumentListService,
|
||||||
private documentListService: DocumentListService,
|
private translateService: AlfrescoTranslateService,
|
||||||
private translateService: AlfrescoTranslateService) {
|
private logService: LogService) {
|
||||||
|
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
translateService.addTranslationFolder('ng2-alfresco-documentlist', 'node_modules/ng2-alfresco-documentlist/src');
|
translateService.addTranslationFolder('ng2-alfresco-documentlist', 'node_modules/ng2-alfresco-documentlist/src');
|
||||||
@ -66,7 +66,7 @@ export class DocumentMenuAction {
|
|||||||
.subscribe(
|
.subscribe(
|
||||||
(res: MinimalNodeEntity) => {
|
(res: MinimalNodeEntity) => {
|
||||||
this.folderName = '';
|
this.folderName = '';
|
||||||
console.log(res.entry);
|
this.logService.info(res.entry);
|
||||||
this.success.emit({node: res.entry});
|
this.success.emit({node: res.entry});
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
@ -74,10 +74,10 @@ export class DocumentMenuAction {
|
|||||||
if (errorMessagePlaceholder) {
|
if (errorMessagePlaceholder) {
|
||||||
this.message = this.formatString(errorMessagePlaceholder, [name]);
|
this.message = this.formatString(errorMessagePlaceholder, [name]);
|
||||||
this.error.emit({message: this.message});
|
this.error.emit({message: this.message});
|
||||||
console.log(this.message);
|
this.logService.error(this.message);
|
||||||
} else {
|
} else {
|
||||||
this.error.emit(error);
|
this.error.emit(error);
|
||||||
console.log(error);
|
this.logService.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { SettingsService, AuthService, AlfrescoApiService, StorageService, ContentService } from 'ng2-alfresco-core';
|
import { SettingsService, AuthService, AlfrescoApiService, StorageService, ContentService, LogService, LogServiceMock } from 'ng2-alfresco-core';
|
||||||
import { FileNode } from '../assets/document-library.model.mock';
|
import { FileNode } from '../assets/document-library.model.mock';
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { ReflectiveInjector } from '@angular/core';
|
||||||
import { DocumentListService } from './document-list.service';
|
import { DocumentListService } from './document-list.service';
|
||||||
@ -99,7 +99,8 @@ describe('DocumentListService', () => {
|
|||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
ContentService,
|
ContentService,
|
||||||
DocumentListService,
|
DocumentListService,
|
||||||
StorageService
|
StorageService,
|
||||||
|
{ provide: LogService, useClass: LogServiceMock }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
settingsService = injector.get(SettingsService);
|
settingsService = injector.get(SettingsService);
|
||||||
@ -151,7 +152,7 @@ describe('DocumentListService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should emit an error when the folder already exist', () => {
|
xit('should emit an error when the folder already exist', () => {
|
||||||
service.createFolder('fake-name', 'fake-path').subscribe(
|
service.createFolder('fake-name', 'fake-path').subscribe(
|
||||||
res => {
|
res => {
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import { Injectable } from '@angular/core';
|
|||||||
import { Response } from '@angular/http';
|
import { Response } from '@angular/http';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { NodePaging, MinimalNodeEntity, MinimalNodeEntryEntity } from 'alfresco-js-api';
|
import { NodePaging, MinimalNodeEntity, MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||||
import { AuthService, ContentService, AlfrescoApiService } from 'ng2-alfresco-core';
|
import { AuthService, ContentService, AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DocumentListService {
|
export class DocumentListService {
|
||||||
@ -59,7 +59,8 @@ export class DocumentListService {
|
|||||||
|
|
||||||
constructor(private authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
private contentService: ContentService,
|
private contentService: ContentService,
|
||||||
private apiService: AlfrescoApiService) {
|
private apiService: AlfrescoApiService,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private getNodesPromise(folder: string, opts?: any): Promise<NodePaging> {
|
private getNodesPromise(folder: string, opts?: any): Promise<NodePaging> {
|
||||||
@ -114,7 +115,6 @@ export class DocumentListService {
|
|||||||
getFolder(folder: string, opts?: any) {
|
getFolder(folder: string, opts?: any) {
|
||||||
return Observable.fromPromise(this.getNodesPromise(folder, opts))
|
return Observable.fromPromise(this.getNodesPromise(folder, opts))
|
||||||
.map(res => <NodePaging> res)
|
.map(res => <NodePaging> res)
|
||||||
// .do(data => console.log('Node data', data)) // eyeball results in the console
|
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ export class DocumentListService {
|
|||||||
private handleError(error: Response) {
|
private handleError(error: Response) {
|
||||||
// in a real world app, we may send the error to some remote logging infrastructure
|
// in a real world app, we may send the error to some remote logging infrastructure
|
||||||
// instead of just logging it to the console
|
// instead of just logging it to the console
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
return Observable.throw(error || 'Server error');
|
return Observable.throw(error || 'Server error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import { NgModule, Component } from '@angular/core';
|
|||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { CoreModule, SettingsService, AuthService, StorageService } from 'ng2-alfresco-core';
|
import { CoreModule, SettingsService, AuthService, StorageService, LogService } from 'ng2-alfresco-core';
|
||||||
import { LoginModule } from 'ng2-alfresco-login';
|
import { LoginModule } from 'ng2-alfresco-login';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -61,41 +61,37 @@ import { LoginModule } from 'ng2-alfresco-login';
|
|||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
|
|
||||||
public ecmHost: string = 'http://localhost:8080';
|
ecmHost: string = 'http://localhost:8080';
|
||||||
|
bpmHost: string = 'http://localhost:9999';
|
||||||
|
ticket: string;
|
||||||
|
status: string = '';
|
||||||
|
providers: string = 'ECM';
|
||||||
|
disableCsrf: boolean = false;
|
||||||
|
|
||||||
public bpmHost: string = 'http://localhost:9999';
|
constructor(private authService: AuthService,
|
||||||
|
|
||||||
public ticket: string;
|
|
||||||
|
|
||||||
public status: string = '';
|
|
||||||
|
|
||||||
public providers: string = 'ECM';
|
|
||||||
|
|
||||||
public disableCsrf: boolean = false;
|
|
||||||
|
|
||||||
constructor(public authService: AuthService,
|
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService,
|
||||||
|
private logService: LogService) {
|
||||||
|
|
||||||
settingsService.ecmHost = this.ecmHost;
|
settingsService.ecmHost = this.ecmHost;
|
||||||
settingsService.bpmHost = this.bpmHost;
|
settingsService.bpmHost = this.bpmHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateEcmHost(): void {
|
updateEcmHost(): void {
|
||||||
this.settingsService.ecmHost = this.ecmHost;
|
this.settingsService.ecmHost = this.ecmHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateBpmHost(): void {
|
updateBpmHost(): void {
|
||||||
this.settingsService.bpmHost = this.bpmHost;
|
this.settingsService.bpmHost = this.bpmHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
mySuccessMethod($event) {
|
mySuccessMethod($event) {
|
||||||
console.log('Success Login EventEmitt called with: ' + $event.value);
|
this.logService.info('Success Login EventEmitt called with: ' + $event.value);
|
||||||
this.status = $event.value;
|
this.status = $event.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
myErrorMethod($event) {
|
myErrorMethod($event) {
|
||||||
console.log('Error Login EventEmitt called with: ' + $event.value);
|
this.logService.error('Error Login EventEmitt called with: ' + $event.value);
|
||||||
this.status = $event.value;
|
this.status = $event.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,13 +17,8 @@
|
|||||||
|
|
||||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||||
import { DebugElement } from '@angular/core';
|
import { DebugElement } from '@angular/core';
|
||||||
import {
|
import { AuthService, CoreModule } from 'ng2-alfresco-core';
|
||||||
AuthService,
|
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
||||||
SettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
CoreModule
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
|
||||||
import { AlfrescoLoginComponent } from './alfresco-login.component';
|
import { AlfrescoLoginComponent } from './alfresco-login.component';
|
||||||
import { AuthenticationMock } from './../assets/authentication.service.mock';
|
import { AuthenticationMock } from './../assets/authentication.service.mock';
|
||||||
import { TranslationMock } from './../assets/translation.service.mock';
|
import { TranslationMock } from './../assets/translation.service.mock';
|
||||||
@ -39,15 +34,12 @@ describe('AlfrescoLogin', () => {
|
|||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
CoreModule
|
CoreModule.forRoot()
|
||||||
],
|
],
|
||||||
declarations: [AlfrescoLoginComponent],
|
declarations: [AlfrescoLoginComponent],
|
||||||
providers: [
|
providers: [
|
||||||
SettingsService,
|
|
||||||
AuthService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
{provide: AuthService, useClass: AuthenticationMock},
|
{provide: AuthService, useClass: AuthenticationMock},
|
||||||
{provide: AlfrescoTranslationService, useClass: TranslationMock}
|
{provide: AlfrescoTranslateService, useClass: TranslationMock}
|
||||||
]
|
]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
@ -17,11 +17,7 @@
|
|||||||
|
|
||||||
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
|
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
|
||||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||||
import {
|
import { AlfrescoTranslateService, AuthService, SettingsService, LogService } from 'ng2-alfresco-core';
|
||||||
AlfrescoTranslationService,
|
|
||||||
AuthService,
|
|
||||||
SettingsService
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
import { FormSubmitEvent } from '../models/form-submit-event.model';
|
import { FormSubmitEvent } from '../models/form-submit-event.model';
|
||||||
|
|
||||||
declare let componentHandler: any;
|
declare let componentHandler: any;
|
||||||
@ -79,11 +75,14 @@ export class AlfrescoLoginComponent implements OnInit {
|
|||||||
* @param translate
|
* @param translate
|
||||||
*/
|
*/
|
||||||
constructor(private _fb: FormBuilder,
|
constructor(private _fb: FormBuilder,
|
||||||
public authService: AuthService,
|
private authService: AuthService,
|
||||||
public settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private translate: AlfrescoTranslationService) {
|
private translateService: AlfrescoTranslateService,
|
||||||
|
private logService: LogService) {
|
||||||
|
|
||||||
translate.addTranslationFolder('ng2-alfresco-login', 'node_modules/ng2-alfresco-login/src');
|
if (translateService) {
|
||||||
|
translateService.addTranslationFolder('ng2-alfresco-login', 'node_modules/ng2-alfresco-login/src');
|
||||||
|
}
|
||||||
|
|
||||||
this.initFormError();
|
this.initFormError();
|
||||||
this.initFormFieldsMessages();
|
this.initFormFieldsMessages();
|
||||||
@ -160,9 +159,9 @@ export class AlfrescoLoginComponent implements OnInit {
|
|||||||
this.enableError();
|
this.enableError();
|
||||||
this.errorMsg = 'LOGIN.MESSAGES.LOGIN-ERROR-CREDENTIALS';
|
this.errorMsg = 'LOGIN.MESSAGES.LOGIN-ERROR-CREDENTIALS';
|
||||||
this.onError.emit(err);
|
this.onError.emit(err);
|
||||||
console.log(err);
|
this.logService.error(err);
|
||||||
},
|
},
|
||||||
() => console.log('Login done')
|
() => this.logService.info('Login done')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +174,7 @@ export class AlfrescoLoginComponent implements OnInit {
|
|||||||
this.errorMsg = 'LOGIN.MESSAGES.LOGIN-ERROR-PROVIDERS';
|
this.errorMsg = 'LOGIN.MESSAGES.LOGIN-ERROR-PROVIDERS';
|
||||||
this.enableError();
|
this.enableError();
|
||||||
let messageProviders: any;
|
let messageProviders: any;
|
||||||
messageProviders = this.translate.get(this.errorMsg);
|
messageProviders = this.translateService.get(this.errorMsg);
|
||||||
this.onError.emit(messageProviders.value);
|
this.onError.emit(messageProviders.value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import { NgModule, Component, OnInit } from '@angular/core';
|
|||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { CoreModule } from 'ng2-alfresco-core';
|
import { CoreModule, LogService } from 'ng2-alfresco-core';
|
||||||
import { SearchModule } from 'ng2-alfresco-search';
|
import { SearchModule } from 'ng2-alfresco-search';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -50,16 +50,14 @@ import {
|
|||||||
class SearchDemo implements OnInit {
|
class SearchDemo implements OnInit {
|
||||||
|
|
||||||
authenticated: boolean;
|
authenticated: boolean;
|
||||||
|
searchTerm: string = 'test';
|
||||||
public searchTerm: string = 'test';
|
ecmHost: string = 'http://localhost:8080';
|
||||||
|
|
||||||
public ecmHost: string = 'http://localhost:8080';
|
|
||||||
|
|
||||||
ticket: string;
|
ticket: string;
|
||||||
|
|
||||||
constructor(private authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
translation: AlfrescoTranslationService) {
|
translation: AlfrescoTranslationService,
|
||||||
|
private logService: LogService) {
|
||||||
|
|
||||||
settingsService.ecmHost = this.ecmHost;
|
settingsService.ecmHost = this.ecmHost;
|
||||||
settingsService.setProviders('ECM');
|
settingsService.setProviders('ECM');
|
||||||
@ -79,18 +77,18 @@ class SearchDemo implements OnInit {
|
|||||||
login() {
|
login() {
|
||||||
this.authService.login('admin', 'admin').subscribe(
|
this.authService.login('admin', 'admin').subscribe(
|
||||||
ticket => {
|
ticket => {
|
||||||
console.log(ticket);
|
this.logService.info(ticket);
|
||||||
this.ticket = this.authService.getTicketEcm();
|
this.ticket = this.authService.getTicketEcm();
|
||||||
this.authenticated = true;
|
this.authenticated = true;
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log(error);
|
this.logService.error(error);
|
||||||
this.authenticated = false;
|
this.authenticated = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
searchTermChange(event) {
|
searchTermChange(event) {
|
||||||
console.log('Search term changed', event);
|
this.logService.info('Search term changed', event);
|
||||||
this.searchTerm = event.value;
|
this.searchTerm = event.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,10 @@ import {
|
|||||||
SettingsService,
|
SettingsService,
|
||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
AuthService,
|
AuthService,
|
||||||
ContentService,
|
|
||||||
AlfrescoTranslateService,
|
AlfrescoTranslateService,
|
||||||
CoreModule,
|
CoreModule,
|
||||||
StorageService
|
StorageService,
|
||||||
|
LogService
|
||||||
} from 'ng2-alfresco-core';
|
} from 'ng2-alfresco-core';
|
||||||
|
|
||||||
describe('AlfrescoSearchComponent', () => {
|
describe('AlfrescoSearchComponent', () => {
|
||||||
@ -102,18 +102,13 @@ describe('AlfrescoSearchComponent', () => {
|
|||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
CoreModule
|
CoreModule.forRoot()
|
||||||
],
|
],
|
||||||
declarations: [ AlfrescoSearchComponent ], // declare the test component
|
declarations: [ AlfrescoSearchComponent ], // declare the test component
|
||||||
providers: [
|
providers: [
|
||||||
AlfrescoSearchService,
|
AlfrescoSearchService,
|
||||||
{provide: AlfrescoTranslateService, useClass: TranslationMock},
|
{provide: AlfrescoTranslateService, useClass: TranslationMock},
|
||||||
AlfrescoThumbnailService,
|
AlfrescoThumbnailService
|
||||||
SettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
AuthService,
|
|
||||||
ContentService,
|
|
||||||
StorageService
|
|
||||||
]
|
]
|
||||||
}).compileComponents().then(() => {
|
}).compileComponents().then(() => {
|
||||||
fixture = TestBed.createComponent(AlfrescoSearchComponent);
|
fixture = TestBed.createComponent(AlfrescoSearchComponent);
|
||||||
@ -123,9 +118,7 @@ describe('AlfrescoSearchComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
it('should not have a search term by default', () => {
|
it('should not have a search term by default', () => {
|
||||||
let search = new AlfrescoSearchComponent(null, null, null, null);
|
expect(component.searchTerm).toBe('');
|
||||||
expect(search).toBeDefined();
|
|
||||||
expect(search.searchTerm).toBe('');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should take the provided search term from query param provided via RouteParams', () => {
|
it('should take the provided search term from query param provided via RouteParams', () => {
|
||||||
@ -144,6 +137,7 @@ describe('AlfrescoSearchComponent', () => {
|
|||||||
SettingsService,
|
SettingsService,
|
||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
StorageService,
|
StorageService,
|
||||||
|
LogService,
|
||||||
{ provide: ActivatedRoute, useValue: { params: Observable.from([{}]) } }
|
{ provide: ActivatedRoute, useValue: { params: Observable.from([{}]) } }
|
||||||
]);
|
]);
|
||||||
let search = new AlfrescoSearchComponent(injector.get(AlfrescoSearchService), null, null, injector.get(ActivatedRoute));
|
let search = new AlfrescoSearchComponent(injector.get(AlfrescoSearchService), null, null, injector.get(ActivatedRoute));
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { ReflectiveInjector } from '@angular/core';
|
||||||
import { AlfrescoSearchService } from './alfresco-search.service';
|
import { AlfrescoSearchService } from './alfresco-search.service';
|
||||||
import { AuthService, SettingsService, AlfrescoApiService, StorageService } from 'ng2-alfresco-core';
|
import { AuthService, SettingsService, AlfrescoApiService, StorageService, LogService } from 'ng2-alfresco-core';
|
||||||
import { fakeApi, fakeSearch, fakeError } from '../assets/alfresco-search.service.mock';
|
import { fakeApi, fakeSearch, fakeError } from '../assets/alfresco-search.service.mock';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
@ -34,7 +34,8 @@ describe('AlfrescoSearchService', () => {
|
|||||||
SettingsService,
|
SettingsService,
|
||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
AuthService,
|
AuthService,
|
||||||
StorageService
|
StorageService,
|
||||||
|
LogService
|
||||||
]);
|
]);
|
||||||
service = injector.get(AlfrescoSearchService);
|
service = injector.get(AlfrescoSearchService);
|
||||||
apiService = injector.get(AlfrescoApiService);
|
apiService = injector.get(AlfrescoApiService);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { ReflectiveInjector } from '@angular/core';
|
||||||
import { AlfrescoThumbnailService } from './alfresco-thumbnail.service';
|
import { AlfrescoThumbnailService } from './alfresco-thumbnail.service';
|
||||||
import { AlfrescoApiService, AuthService, ContentService, SettingsService, StorageService } from 'ng2-alfresco-core';
|
import { AlfrescoApiService, AuthService, ContentService, SettingsService, StorageService, LogService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
describe('AlfrescoThumbnailService', () => {
|
describe('AlfrescoThumbnailService', () => {
|
||||||
|
|
||||||
@ -31,7 +31,8 @@ describe('AlfrescoThumbnailService', () => {
|
|||||||
ContentService,
|
ContentService,
|
||||||
SettingsService,
|
SettingsService,
|
||||||
AlfrescoThumbnailService,
|
AlfrescoThumbnailService,
|
||||||
StorageService
|
StorageService,
|
||||||
|
LogService
|
||||||
]);
|
]);
|
||||||
|
|
||||||
service = injector.get(AlfrescoThumbnailService);
|
service = injector.get(AlfrescoThumbnailService);
|
||||||
|
@ -1,116 +1,115 @@
|
|||||||
/*!
|
/*!
|
||||||
* @license
|
* @license
|
||||||
* Copyright 2016 Alfresco Software, Ltd.
|
* Copyright 2016 Alfresco Software, Ltd.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { NgModule, Component, Input, OnInit } from '@angular/core';
|
import { NgModule, Component, Input, OnInit } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { CoreModule, SettingsService, AuthService, StorageService } from 'ng2-alfresco-core';
|
import { CoreModule, SettingsService, AuthService, StorageService, LogService } from 'ng2-alfresco-core';
|
||||||
import { TagModule } from 'ng2-alfresco-tag';
|
import { TagModule } from 'ng2-alfresco-tag';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'alfresco-app-demo',
|
selector: 'alfresco-app-demo',
|
||||||
template: `
|
template: `
|
||||||
<label for="ticket"><b>Insert a valid access ticket / ticket:</b></label><br>
|
<label for="ticket"><b>Insert a valid access ticket / ticket:</b></label><br>
|
||||||
<input id="ticket" type="text" size="48" (change)="updateTicket()" [(ngModel)]="ticket"><br>
|
<input id="ticket" type="text" size="48" (change)="updateTicket()" [(ngModel)]="ticket"><br>
|
||||||
<label for="host"><b>Insert the ip of your Alfresco instance:</b></label><br>
|
<label for="host"><b>Insert the ip of your Alfresco instance:</b></label><br>
|
||||||
<input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="ecmHost"><br><br>
|
<input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="ecmHost"><br><br>
|
||||||
<div *ngIf="!authenticated" style="color:#FF2323">
|
<div *ngIf="!authenticated" style="color:#FF2323">
|
||||||
Authentication failed to ip {{ ecmHost }} with user: admin, admin, you can still try to add a valid ticket to perform
|
Authentication failed to ip {{ ecmHost }} with user: admin, admin, you can still try to add a valid ticket to perform
|
||||||
operations.
|
operations.
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<label for="nodeId"><b>Insert Node Id</b></label><br>
|
<label for="nodeId"><b>Insert Node Id</b></label><br>
|
||||||
<input id="nodeId" type="text" size="48" [(ngModel)]="nodeId"><br>
|
<input id="nodeId" type="text" size="48" [(ngModel)]="nodeId"><br>
|
||||||
<div class="container" *ngIf="authenticated">
|
<div class="container" *ngIf="authenticated">
|
||||||
<div class="mdl-grid">
|
<div class="mdl-grid">
|
||||||
<div class="mdl-cell mdl-cell--4-col"><alfresco-tag-node-actions-list [nodeId]="nodeId"></alfresco-tag-node-actions-list></div>
|
<div class="mdl-cell mdl-cell--4-col"><alfresco-tag-node-actions-list [nodeId]="nodeId"></alfresco-tag-node-actions-list></div>
|
||||||
<div class="mdl-cell mdl-cell--4-col">List Tags ECM <alfresco-tag-list></alfresco-tag-list></div>
|
<div class="mdl-cell mdl-cell--4-col">List Tags ECM <alfresco-tag-list></alfresco-tag-list></div>
|
||||||
<div class="mdl-cell mdl-cell--4-col">
|
<div class="mdl-cell mdl-cell--4-col">
|
||||||
Tag list By Node ID
|
Tag list By Node ID
|
||||||
<alfresco-tag-node-list [nodeId]="nodeId"></alfresco-tag-node-list>
|
<alfresco-tag-node-list [nodeId]="nodeId"></alfresco-tag-node-list>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
class TagDemo implements OnInit {
|
class TagDemo implements OnInit {
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
nodeId: string = '74cd8a96-8a21-47e5-9b3b-a1b3e296787d';
|
nodeId: string = '74cd8a96-8a21-47e5-9b3b-a1b3e296787d';
|
||||||
|
|
||||||
authenticated: boolean;
|
authenticated: boolean;
|
||||||
|
ecmHost: string = 'http://127.0.0.1:8080';
|
||||||
ecmHost: string = 'http://127.0.0.1:8080';
|
ticket: string;
|
||||||
|
|
||||||
ticket: string;
|
|
||||||
|
|
||||||
constructor(private authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService,
|
||||||
|
private logService: LogService) {
|
||||||
settingsService.ecmHost = this.ecmHost;
|
|
||||||
settingsService.setProviders('ECM');
|
settingsService.ecmHost = this.ecmHost;
|
||||||
|
settingsService.setProviders('ECM');
|
||||||
if (this.authService.getTicketEcm()) {
|
|
||||||
this.ticket = this.authService.getTicketEcm();
|
if (this.authService.getTicketEcm()) {
|
||||||
}
|
this.ticket = this.authService.getTicketEcm();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ngOnInit() {
|
|
||||||
this.login();
|
ngOnInit() {
|
||||||
}
|
this.login();
|
||||||
|
}
|
||||||
login() {
|
|
||||||
this.authService.login('admin', 'admin').subscribe(
|
login() {
|
||||||
ticket => {
|
this.authService.login('admin', 'admin').subscribe(
|
||||||
console.log(ticket);
|
ticket => {
|
||||||
this.ticket = this.authService.getTicketEcm();
|
this.logService.info(ticket);
|
||||||
this.authenticated = true;
|
this.ticket = this.authService.getTicketEcm();
|
||||||
},
|
this.authenticated = true;
|
||||||
error => {
|
},
|
||||||
console.log(error);
|
error => {
|
||||||
this.authenticated = false;
|
this.logService.error(error);
|
||||||
});
|
this.authenticated = false;
|
||||||
}
|
});
|
||||||
|
}
|
||||||
public updateTicket(): void {
|
|
||||||
this.storage.setItem('ticket-ECM', this.ticket);
|
public updateTicket(): void {
|
||||||
}
|
this.storage.setItem('ticket-ECM', this.ticket);
|
||||||
|
}
|
||||||
public updateHost(): void {
|
|
||||||
this.settingsService.ecmHost = this.ecmHost;
|
public updateHost(): void {
|
||||||
this.login();
|
this.settingsService.ecmHost = this.ecmHost;
|
||||||
}
|
this.login();
|
||||||
|
}
|
||||||
logData(data) {
|
|
||||||
console.log(data);
|
logData(data) {
|
||||||
}
|
this.logService.info(data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@NgModule({
|
|
||||||
imports: [
|
@NgModule({
|
||||||
BrowserModule,
|
imports: [
|
||||||
CoreModule.forRoot(),
|
BrowserModule,
|
||||||
TagModule
|
CoreModule.forRoot(),
|
||||||
],
|
TagModule
|
||||||
declarations: [ TagDemo ],
|
],
|
||||||
bootstrap: [ TagDemo ]
|
declarations: [ TagDemo ],
|
||||||
})
|
bootstrap: [ TagDemo ]
|
||||||
export class AppModule { }
|
})
|
||||||
|
export class AppModule { }
|
||||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
|
||||||
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
import { AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {TagService} .
|
* @returns {TagService} .
|
||||||
@ -31,7 +31,8 @@ export class TagService {
|
|||||||
* Constructor
|
* Constructor
|
||||||
* @param apiService
|
* @param apiService
|
||||||
*/
|
*/
|
||||||
constructor(private apiService: AlfrescoApiService) {
|
constructor(private apiService: AlfrescoApiService,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
getTagsByNodeId(nodeId: string): any {
|
getTagsByNodeId(nodeId: string): any {
|
||||||
@ -59,7 +60,7 @@ export class TagService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleError(error: any) {
|
private handleError(error: any) {
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
return Observable.throw(error || 'Server error');
|
return Observable.throw(error || 'Server error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import { NgModule, Component, OnInit } from '@angular/core';
|
|||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { CoreModule, SettingsService, AuthService, StorageService } from 'ng2-alfresco-core';
|
import { CoreModule, SettingsService, AuthService, StorageService, LogService } from 'ng2-alfresco-core';
|
||||||
import { UploadModule } from 'ng2-alfresco-upload';
|
import { UploadModule } from 'ng2-alfresco-upload';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -103,19 +103,18 @@ import { UploadModule } from 'ng2-alfresco-upload';
|
|||||||
})
|
})
|
||||||
export class MyDemoApp implements OnInit {
|
export class MyDemoApp implements OnInit {
|
||||||
|
|
||||||
public ecmHost: string = 'http://localhost:8080';
|
ecmHost: string = 'http://localhost:8080';
|
||||||
|
|
||||||
authenticated: boolean;
|
authenticated: boolean;
|
||||||
multipleFileUpload: boolean = false;
|
multipleFileUpload: boolean = false;
|
||||||
folderUpload: boolean = false;
|
folderUpload: boolean = false;
|
||||||
acceptedFilesTypeShow: boolean = false;
|
acceptedFilesTypeShow: boolean = false;
|
||||||
versioning: boolean = false;
|
versioning: boolean = false;
|
||||||
|
|
||||||
ticket: string;
|
ticket: string;
|
||||||
|
|
||||||
constructor(private authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService,
|
||||||
|
private logService: LogService) {
|
||||||
settingsService.ecmHost = this.ecmHost;
|
settingsService.ecmHost = this.ecmHost;
|
||||||
settingsService.setProviders('ECM');
|
settingsService.setProviders('ECM');
|
||||||
|
|
||||||
@ -124,32 +123,32 @@ export class MyDemoApp implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateTicket(): void {
|
updateTicket(): void {
|
||||||
this.storage.setItem('ticket-ECM', this.ticket);
|
this.storage.setItem('ticket-ECM', this.ticket);
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateHost(): void {
|
updateHost(): void {
|
||||||
this.settingsService.ecmHost = this.ecmHost;
|
this.settingsService.ecmHost = this.ecmHost;
|
||||||
this.login();
|
this.login();
|
||||||
}
|
}
|
||||||
|
|
||||||
public customMethod(event: Object): void {
|
customMethod(event: Object): void {
|
||||||
console.log('File uploaded');
|
this.logService.info('File uploaded');
|
||||||
}
|
}
|
||||||
|
|
||||||
public ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.login();
|
this.login();
|
||||||
}
|
}
|
||||||
|
|
||||||
login() {
|
login() {
|
||||||
this.authService.login('admin', 'admin').subscribe(
|
this.authService.login('admin', 'admin').subscribe(
|
||||||
ticket => {
|
ticket => {
|
||||||
console.log(ticket);
|
this.logService.info(ticket);
|
||||||
this.ticket = this.authService.getTicketEcm();
|
this.ticket = this.authService.getTicketEcm();
|
||||||
this.authenticated = true;
|
this.authenticated = true;
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log(error);
|
this.logService.error(error);
|
||||||
this.authenticated = false;
|
this.authenticated = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Component, ViewChild, ElementRef, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, ViewChild, ElementRef, Input, Output, EventEmitter } from '@angular/core';
|
||||||
import 'rxjs/Rx';
|
import 'rxjs/Rx';
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { UploadService } from '../services/upload.service';
|
import { UploadService } from '../services/upload.service';
|
||||||
import { FileModel } from '../models/file.model';
|
import { FileModel } from '../models/file.model';
|
||||||
|
|
||||||
@ -88,9 +88,10 @@ export class UploadButtonComponent {
|
|||||||
@Output()
|
@Output()
|
||||||
createFolder = new EventEmitter();
|
createFolder = new EventEmitter();
|
||||||
|
|
||||||
constructor(public el: ElementRef,
|
constructor(private el: ElementRef,
|
||||||
private uploadService: UploadService,
|
private uploadService: UploadService,
|
||||||
private translateService: AlfrescoTranslateService) {
|
private translateService: AlfrescoTranslateService,
|
||||||
|
private logService: LogService) {
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
translateService.addTranslationFolder('ng2-alfresco-upload', 'node_modules/ng2-alfresco-upload/src');
|
translateService.addTranslationFolder('ng2-alfresco-upload', 'node_modules/ng2-alfresco-upload/src');
|
||||||
}
|
}
|
||||||
@ -141,7 +142,7 @@ export class UploadButtonComponent {
|
|||||||
this._showErrorNotificationBar(errorMessage);
|
this._showErrorNotificationBar(errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(error);
|
this.logService.error(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -16,9 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||||
import { EventEmitter } from '@angular/core';
|
import { EventEmitter, DebugElement } from '@angular/core';
|
||||||
import { DebugElement } from '@angular/core';
|
import { AlfrescoTranslateService, CoreModule, LogService } from 'ng2-alfresco-core';
|
||||||
import { AlfrescoTranslateService, CoreModule } from 'ng2-alfresco-core';
|
|
||||||
|
|
||||||
import { UploadDragAreaComponent } from './upload-drag-area.component';
|
import { UploadDragAreaComponent } from './upload-drag-area.component';
|
||||||
import { TranslationMock } from '../assets/translation.service.mock';
|
import { TranslationMock } from '../assets/translation.service.mock';
|
||||||
@ -31,6 +30,7 @@ describe('UploadDragAreaComponent', () => {
|
|||||||
let debug: DebugElement;
|
let debug: DebugElement;
|
||||||
let element: HTMLElement;
|
let element: HTMLElement;
|
||||||
let uploadService: UploadService;
|
let uploadService: UploadService;
|
||||||
|
let logService: LogService;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@ -48,6 +48,7 @@ describe('UploadDragAreaComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
logService = TestBed.get(LogService);
|
||||||
fixture = TestBed.createComponent(UploadDragAreaComponent);
|
fixture = TestBed.createComponent(UploadDragAreaComponent);
|
||||||
uploadService = TestBed.get(UploadService);
|
uploadService = TestBed.get(UploadService);
|
||||||
|
|
||||||
@ -64,12 +65,12 @@ describe('UploadDragAreaComponent', () => {
|
|||||||
|
|
||||||
it('should show an folder non supported error in console when the file type is empty', () => {
|
it('should show an folder non supported error in console when the file type is empty', () => {
|
||||||
component.showUdoNotificationBar = false;
|
component.showUdoNotificationBar = false;
|
||||||
spyOn(console, 'error');
|
spyOn(logService, 'error');
|
||||||
|
|
||||||
let fileFake = new File([''], 'folder-fake', {type: ''});
|
let fileFake = new File([''], 'folder-fake', {type: ''});
|
||||||
component.onFilesDropped([fileFake]);
|
component.onFilesDropped([fileFake]);
|
||||||
|
|
||||||
expect(console.error).toHaveBeenCalledWith('FILE_UPLOAD.MESSAGES.FOLDER_NOT_SUPPORTED');
|
expect(logService.error).toHaveBeenCalledWith('FILE_UPLOAD.MESSAGES.FOLDER_NOT_SUPPORTED');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show an folder non supported error in the notification bar when the file type is empty', () => {
|
it('should show an folder non supported error in the notification bar when the file type is empty', () => {
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, ViewChild, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, ViewChild, Input, Output, EventEmitter } from '@angular/core';
|
||||||
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { UploadService } from '../services/upload.service';
|
import { UploadService } from '../services/upload.service';
|
||||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
|
||||||
import { FileModel } from '../models/file.model';
|
import { FileModel } from '../models/file.model';
|
||||||
|
|
||||||
declare let componentHandler: any;
|
declare let componentHandler: any;
|
||||||
@ -62,7 +62,8 @@ export class UploadDragAreaComponent {
|
|||||||
onSuccess = new EventEmitter();
|
onSuccess = new EventEmitter();
|
||||||
|
|
||||||
constructor(private uploadService: UploadService,
|
constructor(private uploadService: UploadService,
|
||||||
private translateService: AlfrescoTranslateService) {
|
private translateService: AlfrescoTranslateService,
|
||||||
|
private logService: LogService) {
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
translateService.addTranslationFolder('ng2-alfresco-upload', 'node_modules/ng2-alfresco-upload/src');
|
translateService.addTranslationFolder('ng2-alfresco-upload', 'node_modules/ng2-alfresco-upload/src');
|
||||||
}
|
}
|
||||||
@ -93,7 +94,7 @@ export class UploadDragAreaComponent {
|
|||||||
if (this.showUdoNotificationBar) {
|
if (this.showUdoNotificationBar) {
|
||||||
this.showErrorNotificationBar(errorMessage.value);
|
this.showErrorNotificationBar(errorMessage.value);
|
||||||
} else {
|
} else {
|
||||||
console.error(errorMessage.value);
|
this.logService.error(errorMessage.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,7 +157,7 @@ export class UploadDragAreaComponent {
|
|||||||
if (this.showUdoNotificationBar) {
|
if (this.showUdoNotificationBar) {
|
||||||
this.showErrorNotificationBar(errorMessage);
|
this.showErrorNotificationBar(errorMessage);
|
||||||
} else {
|
} else {
|
||||||
console.error(errorMessage);
|
this.logService.error(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,6 @@ describe('UploadService', () => {
|
|||||||
service.addToQueue(filesFake);
|
service.addToQueue(filesFake);
|
||||||
service.uploadFilesInTheQueue('-root-', '', emitter);
|
service.uploadFilesInTheQueue('-root-', '', emitter);
|
||||||
|
|
||||||
console.log(jasmine.Ajax.requests.mostRecent().url);
|
|
||||||
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('autoRename=true')).toBe(false);
|
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('autoRename=true')).toBe(false);
|
||||||
expect(jasmine.Ajax.requests.mostRecent().params.has('majorVersion')).toBe(true);
|
expect(jasmine.Ajax.requests.mostRecent().params.has('majorVersion')).toBe(true);
|
||||||
});
|
});
|
||||||
|
@ -17,9 +17,8 @@
|
|||||||
|
|
||||||
import { EventEmitter, Injectable } from '@angular/core';
|
import { EventEmitter, Injectable } from '@angular/core';
|
||||||
import { Response } from '@angular/http';
|
import { Response } from '@angular/http';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observer, Observable } from 'rxjs/Rx';
|
||||||
import { Observer } from 'rxjs/Observer';
|
import { AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
|
||||||
import { FileModel } from '../models/file.model';
|
import { FileModel } from '../models/file.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,18 +32,16 @@ export class UploadService {
|
|||||||
|
|
||||||
private formFields: Object = {};
|
private formFields: Object = {};
|
||||||
private queue: FileModel[] = [];
|
private queue: FileModel[] = [];
|
||||||
|
|
||||||
private versioning: boolean = false;
|
private versioning: boolean = false;
|
||||||
|
|
||||||
private filesUploadObserverProgressBar: Observer<FileModel[]>;
|
private filesUploadObserverProgressBar: Observer<FileModel[]>;
|
||||||
private totalCompletedObserver: Observer<number>;
|
private totalCompletedObserver: Observer<number>;
|
||||||
|
|
||||||
public totalCompleted: number = 0;
|
totalCompleted: number = 0;
|
||||||
|
|
||||||
filesUpload$: Observable<FileModel[]>;
|
filesUpload$: Observable<FileModel[]>;
|
||||||
totalCompleted$: Observable<any>;
|
totalCompleted$: Observable<any>;
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService) {
|
constructor(private apiService: AlfrescoApiService,
|
||||||
|
private logService: LogService) {
|
||||||
this.filesUpload$ = new Observable<FileModel[]>(observer => this.filesUploadObserverProgressBar = observer).share();
|
this.filesUpload$ = new Observable<FileModel[]>(observer => this.filesUploadObserverProgressBar = observer).share();
|
||||||
this.totalCompleted$ = new Observable<number>(observer => this.totalCompletedObserver = observer).share();
|
this.totalCompleted$ = new Observable<number>(observer => this.totalCompletedObserver = observer).share();
|
||||||
}
|
}
|
||||||
@ -56,7 +53,7 @@ export class UploadService {
|
|||||||
* @param {boolean} - versioning true to indicate that a major version should be created
|
* @param {boolean} - versioning true to indicate that a major version should be created
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public setOptions(options: any, versioning: boolean): void {
|
setOptions(options: any, versioning: boolean): void {
|
||||||
this.formFields = options.formFields != null ? options.formFields : this.formFields;
|
this.formFields = options.formFields != null ? options.formFields : this.formFields;
|
||||||
this.versioning = versioning != null ? versioning : this.versioning;
|
this.versioning = versioning != null ? versioning : this.versioning;
|
||||||
}
|
}
|
||||||
@ -87,7 +84,7 @@ export class UploadService {
|
|||||||
/**
|
/**
|
||||||
* Pick all the files in the queue that are not been uploaded yet and upload it into the directory folder.
|
* Pick all the files in the queue that are not been uploaded yet and upload it into the directory folder.
|
||||||
*/
|
*/
|
||||||
public uploadFilesInTheQueue(rootId: string, directory: string, elementEmit: EventEmitter<any>): void {
|
uploadFilesInTheQueue(rootId: string, directory: string, elementEmit: EventEmitter<any>): void {
|
||||||
let filesToUpload = this.queue.filter((uploadingFileModel) => {
|
let filesToUpload = this.queue.filter((uploadingFileModel) => {
|
||||||
return !uploadingFileModel.uploading && !uploadingFileModel.done && !uploadingFileModel.abort && !uploadingFileModel.error;
|
return !uploadingFileModel.uploading && !uploadingFileModel.done && !uploadingFileModel.abort && !uploadingFileModel.error;
|
||||||
});
|
});
|
||||||
@ -169,7 +166,7 @@ export class UploadService {
|
|||||||
.map(res => {
|
.map(res => {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.do(data => console.log('Node data', data)) // eyeball results in the console
|
.do(data => this.logService.info('Node data', data)) // eyeball results in the console
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +182,7 @@ export class UploadService {
|
|||||||
private handleError(error: Response) {
|
private handleError(error: Response) {
|
||||||
// in a real world app, we may send the error to some remote logging infrastructure
|
// in a real world app, we may send the error to some remote logging infrastructure
|
||||||
// instead of just logging it to the console
|
// instead of just logging it to the console
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
return Observable.throw(error || 'Server error');
|
return Observable.throw(error || 'Server error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,9 +19,8 @@ import { NgModule, Component, OnInit } from '@angular/core';
|
|||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { UserInfoComponentModule } from 'ng2-alfresco-userinfo';
|
import { UserInfoComponentModule } from 'ng2-alfresco-userinfo';
|
||||||
import { CoreModule } from 'ng2-alfresco-core';
|
import { CoreModule, AuthService, SettingsService, LogService } from 'ng2-alfresco-core';
|
||||||
import { LoginModule } from 'ng2-alfresco-login';
|
import { LoginModule } from 'ng2-alfresco-login';
|
||||||
import { AuthService, SettingsService } from 'ng2-alfresco-core';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'alfresco-app-demo',
|
selector: 'alfresco-app-demo',
|
||||||
@ -74,26 +73,21 @@ import { AuthService, SettingsService } from 'ng2-alfresco-core';
|
|||||||
})
|
})
|
||||||
class UserInfoDemo implements OnInit {
|
class UserInfoDemo implements OnInit {
|
||||||
|
|
||||||
public ecmHost: string = 'http://localhost:8080';
|
ecmHost: string = 'http://localhost:8080';
|
||||||
|
bpmHost: string = 'http://localhost:9999';
|
||||||
public bpmHost: string = 'http://localhost:9999';
|
userToLogin: string = 'admin';
|
||||||
|
password: string = 'admin';
|
||||||
public userToLogin: string = 'admin';
|
loginErrorMessage: string;
|
||||||
|
providers: string = 'BPM';
|
||||||
public password: string = 'admin';
|
|
||||||
|
|
||||||
public loginErrorMessage: string;
|
|
||||||
|
|
||||||
public providers: string = 'BPM';
|
|
||||||
|
|
||||||
private authenticated: boolean;
|
private authenticated: boolean;
|
||||||
|
|
||||||
private token: any;
|
private token: any;
|
||||||
|
|
||||||
public disableCsrf: boolean = false;
|
disableCsrf: boolean = false;
|
||||||
|
|
||||||
constructor(private authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
private settingsService: SettingsService) {
|
private settingsService: SettingsService,
|
||||||
|
private logService: LogService) {
|
||||||
settingsService.ecmHost = this.ecmHost;
|
settingsService.ecmHost = this.ecmHost;
|
||||||
settingsService.bpmHost = this.bpmHost;
|
settingsService.bpmHost = this.bpmHost;
|
||||||
}
|
}
|
||||||
@ -110,12 +104,12 @@ class UserInfoDemo implements OnInit {
|
|||||||
this.settingsService.setProviders(this.providers);
|
this.settingsService.setProviders(this.providers);
|
||||||
this.authService.login(user, password).subscribe(
|
this.authService.login(user, password).subscribe(
|
||||||
token => {
|
token => {
|
||||||
console.log(token);
|
this.logService.info(token);
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this.authenticated = true;
|
this.authenticated = true;
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log(error);
|
this.logService.error(error);
|
||||||
this.authenticated = false;
|
this.authenticated = false;
|
||||||
this.loginErrorMessage = error;
|
this.loginErrorMessage = error;
|
||||||
});
|
});
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Response } from '@angular/http';
|
import { Response } from '@angular/http';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
import { AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||||
import { BpmUserModel } from '../models/bpm-user.model';
|
import { BpmUserModel } from '../models/bpm-user.model';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -29,7 +29,8 @@ import { BpmUserModel } from '../models/bpm-user.model';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class BpmUserService {
|
export class BpmUserService {
|
||||||
|
|
||||||
constructor(private alfrescoJsApi: AlfrescoApiService) {
|
constructor(private alfrescoJsApi: AlfrescoApiService,
|
||||||
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,7 +55,7 @@ export class BpmUserService {
|
|||||||
private handleError(error: Response) {
|
private handleError(error: Response) {
|
||||||
// in a real world app, we may send the error to some remote logging infrastructure
|
// in a real world app, we may send the error to some remote logging infrastructure
|
||||||
// instead of just logging it to the console
|
// instead of just logging it to the console
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
return Observable.throw(error || 'Server error');
|
return Observable.throw(error || 'Server error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user