From f63b8700b48db1d7d1bacb524af2c1ca933caf54 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Wed, 17 Aug 2016 17:55:29 +0100 Subject: [PATCH] name unify for setting import --- .../demo/package.json | 2 +- .../ng2-activiti-processlist/demo/src/main.ts | 46 +++++++------ .../ng2-activiti-processlist/package.json | 3 +- .../activiti-process-service.service.ts | 4 +- .../ng2-activiti-tasklist/demo/package.json | 3 +- .../ng2-activiti-tasklist/demo/src/main.ts | 66 ++++++++++++++----- .../ng2-activiti-tasklist/package.json | 4 +- .../demo/src/main.ts | 6 +- .../ng2-alfresco-login/demo/src/main.ts | 6 +- .../components/alfresco-login.component.ts | 6 +- .../ng2-alfresco-search/demo/src/main.ts | 6 +- .../ng2-alfresco-upload/demo/src/main.ts | 6 +- .../ng2-alfresco-viewer/demo/src/main.ts | 6 +- .../ng2-alfresco-webscript/demo/src/main.ts | 12 ++-- 14 files changed, 109 insertions(+), 67 deletions(-) diff --git a/ng2-components/ng2-activiti-processlist/demo/package.json b/ng2-components/ng2-activiti-processlist/demo/package.json index 537f57f7fc..6352876ba3 100644 --- a/ng2-components/ng2-activiti-processlist/demo/package.json +++ b/ng2-components/ng2-activiti-processlist/demo/package.json @@ -39,7 +39,7 @@ "rxjs": "5.0.0-beta.6", "zone.js": "^0.6.12", "ng2-activiti-processlist": "file:../", - "alfresco-js-api": "^0.1.0", + "alfresco-js-api": "^0.2.0", "material-design-icons": "^2.2.3", "material-design-lite": "^1.1.3" }, diff --git a/ng2-components/ng2-activiti-processlist/demo/src/main.ts b/ng2-components/ng2-activiti-processlist/demo/src/main.ts index d3487dd38a..36900923c0 100644 --- a/ng2-components/ng2-activiti-processlist/demo/src/main.ts +++ b/ng2-components/ng2-activiti-processlist/demo/src/main.ts @@ -25,27 +25,45 @@ import { AlfrescoSettingsService, ALFRESCO_CORE_PROVIDERS } from 'ng2-alfresco-core'; -import { HTTP_PROVIDERS, BrowserXhr } from '@angular/http'; @Component({ selector: 'my-app', - template: ``, + template: `label for="token">Insert a valid access token / ticket:
+
+
+

+
+ Authentication failed to ip {{ bpmHost }} with user: admin, admin, you can still try to add a valid token to perform + operations. +
+
+
+
+
+
+
+
+
+ +
`, providers: [ACTIVITI_PROCESSLIST_PROVIDERS], directives: [ACTIVITI_PROCESSLIST_DIRECTIVES] }) class MyDemoApp implements OnInit { authenticated: boolean; - ecmHost: string = 'http://127.0.0.1:9999'; + ecmHost: string = 'http://127.0.0.1:9999'; token: string; constructor( private authService: AlfrescoAuthenticationService, - private alfrescoSettingsService: AlfrescoSettingsService + private settingsService: AlfrescoSettingsService ) { console.log('constructor'); - alfrescoSettingsService.ecmHost = this.ecmHost; + settingsService.setProviders('BPM'); + settingsService.bpmHost = this.bpmHost; + if (this.authService.getTicket()) { this.token = this.authService.getTicket(); } @@ -60,12 +78,12 @@ class MyDemoApp implements OnInit { } public updateHost(): void { - this.alfrescoSettingsService.ecmHost = this.ecmHost; + this.settingsService.ecmHost = this.ecmHost; this.login(); } login() { - this.authService.login('admin@app.activiti.com', 'admin', ['BPM']).subscribe( + this.authService.login('admin', 'admin').subscribe( token => { console.log(token); this.token = token; @@ -78,18 +96,6 @@ class MyDemoApp implements OnInit { } } -@Injectable() -export class CustomBrowserXhr extends BrowserXhr { - constructor() {} - build(): any { - let xhr = super.build(); - xhr.withCredentials = true; - return (xhr); - } -} - bootstrap(MyDemoApp, [ - ALFRESCO_CORE_PROVIDERS, - HTTP_PROVIDERS, - provide(BrowserXhr, { useClass: CustomBrowserXhr }) + ALFRESCO_CORE_PROVIDERS ]); diff --git a/ng2-components/ng2-activiti-processlist/package.json b/ng2-components/ng2-activiti-processlist/package.json index 534fbe99cc..1249461de4 100644 --- a/ng2-components/ng2-activiti-processlist/package.json +++ b/ng2-components/ng2-activiti-processlist/package.json @@ -63,7 +63,8 @@ "zone.js": "^0.6.12", "ng2-translate": "2.2.2", "ng2-alfresco-core": "0.2.0", - "ng2-alfresco-datatable": "0.2.0" + "ng2-alfresco-datatable": "0.2.0", + "alfresco-js-api": "^0.2.0" }, "devDependencies": { "angular-cli": "1.0.0-beta.9", diff --git a/ng2-components/ng2-activiti-processlist/src/services/activiti-process-service.service.ts b/ng2-components/ng2-activiti-processlist/src/services/activiti-process-service.service.ts index 9339ed7ed1..de8287985a 100644 --- a/ng2-components/ng2-activiti-processlist/src/services/activiti-process-service.service.ts +++ b/ng2-components/ng2-activiti-processlist/src/services/activiti-process-service.service.ts @@ -27,7 +27,7 @@ import 'rxjs/add/operator/catch'; export class ActivitiProcessService { - constructor(private alfrescoSettingsService: AlfrescoSettingsService, private http: Http) { + constructor(private settingsService: AlfrescoSettingsService, private http: Http) { } getProcesses(): Observable { @@ -35,7 +35,7 @@ export class ActivitiProcessService { headers.append('Content-Type', 'application/json'); // headers.append('Authorization', 'Basic ' + btoa('admin@app.activiti.com:admin')); return this.http.post( - this.alfrescoSettingsService.bpmHost + '/activiti-app/api/enterprise/process-instances/query', + this.settingsService.bpmHost + '/activiti-app/api/enterprise/process-instances/query', '{"page":0,"sort":"created-desc","state":"all"}', new RequestOptions({ headers: headers diff --git a/ng2-components/ng2-activiti-tasklist/demo/package.json b/ng2-components/ng2-activiti-tasklist/demo/package.json index 8b0a30c592..c52e40def5 100644 --- a/ng2-components/ng2-activiti-tasklist/demo/package.json +++ b/ng2-components/ng2-activiti-tasklist/demo/package.json @@ -33,11 +33,10 @@ "rxjs": "5.0.0-beta.6", "zone.js": "0.6.12", "license-check": "1.1.5", - "material-design-icons": "2.2.3", "material-design-lite": "1.1.3", "ng2-translate": "2.2.2", - + "alfresco-js-api": "^0.2.0", "ng2-alfresco-datatable": "^0.1.12", "ng2-alfresco-core": "^0.1.36" }, diff --git a/ng2-components/ng2-activiti-tasklist/demo/src/main.ts b/ng2-components/ng2-activiti-tasklist/demo/src/main.ts index d1ff854273..28fa067a7d 100644 --- a/ng2-components/ng2-activiti-tasklist/demo/src/main.ts +++ b/ng2-components/ng2-activiti-tasklist/demo/src/main.ts @@ -15,36 +15,60 @@ * limitations under the License. */ -import { Component, OnInit } from '@angular/core'; -import { HTTP_PROVIDERS } from '@angular/http'; -import { ALFRESCO_CORE_PROVIDERS, AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core'; -import { bootstrap } from '@angular/platform-browser-dynamic'; -import { ActivitiTaskList } from 'ng2-activiti-tasklist'; -import { ObjectDataTableAdapter, ObjectDataColumn } from 'ng2-alfresco-datatable'; +import {Component, OnInit} from '@angular/core'; +import {ALFRESCO_CORE_PROVIDERS, AlfrescoAuthenticationService, AlfrescoSettingsService} from 'ng2-alfresco-core'; +import {bootstrap} from '@angular/platform-browser-dynamic'; +import {ActivitiTaskList} from 'ng2-activiti-tasklist'; +import {ObjectDataTableAdapter, ObjectDataColumn} from 'ng2-alfresco-datatable'; +import {HTTP_PROVIDERS} from '@angular/http'; declare let AlfrescoApi: any; @Component({ selector: 'activiti-tasklist-demo', - template: ` - - `, + template: `label for="token">Insert a valid access token / ticket:
+
+
+

+
+ Authentication failed to ip {{ bpmHost }} with user: admin, admin, you can still try to add a valid token to perform + operations. +
+
+
+
+
+
+
+
+
+ +
`, styles: [ ':host > .container {padding: 10px}', '.p-10 { padding: 10px; }' ], - directives: [ActivitiTaskList], - providers: [AlfrescoAuthenticationService] + directives: [ActivitiTaskList] }) class ActivitiTaskListDemo implements OnInit { + + bpmHost: string = 'http://127.0.0.1:9999'; + + token: string; + data: ObjectDataTableAdapter; - constructor(private setting: AlfrescoSettingsService) { - this.setting.setProviders(['BPM']); + authenticated: boolean; + + constructor(private authService: AlfrescoAuthenticationService, + private settingsService: AlfrescoSettingsService) { + this.settingsService.setProviders('BPM'); this.data = new ObjectDataTableAdapter([], []); } ngOnInit() { + this.login(); + let schema = [ {type: 'text', key: 'id', title: 'Id'}, {type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true}, @@ -56,9 +80,21 @@ class ActivitiTaskListDemo implements OnInit { this.data.setColumns(columns); } + login() { + this.authService.login('admin', 'admin').subscribe( + token => { + console.log(token); + this.token = token; + this.authenticated = true; + }, + error => { + console.log(error); + this.authenticated = false; + }); + } } bootstrap(ActivitiTaskListDemo, [ - HTTP_PROVIDERS, - ALFRESCO_CORE_PROVIDERS] + HTTP_PROVIDERS, + ALFRESCO_CORE_PROVIDERS] ); diff --git a/ng2-components/ng2-activiti-tasklist/package.json b/ng2-components/ng2-activiti-tasklist/package.json index 3142f4368a..2ac4a0893d 100644 --- a/ng2-components/ng2-activiti-tasklist/package.json +++ b/ng2-components/ng2-activiti-tasklist/package.json @@ -68,9 +68,9 @@ "zone.js": "0.6.12", "ng2-translate": "2.2.2", "ng2-alfresco-core": "0.2.0", - "ng2-alfresco-datatable": "0.2.0", + "ng2-alfresco-datatable": "0.2.0", "ng2-activiti-form": "0.2.0", - "alfresco-js-api": "0.2.0" + "alfresco-js-api": "^0.2.0" }, "peerDependencies": { "material-design-icons": "^2.2.3", diff --git a/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts b/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts index cceb9379d4..1cdf4bdd0d 100644 --- a/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts +++ b/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts @@ -149,11 +149,11 @@ class DocumentListDemo implements OnInit { constructor( private authService: AlfrescoAuthenticationService, - private alfrescoSettingsService: AlfrescoSettingsService, + private settingsService: AlfrescoSettingsService, translation: AlfrescoTranslationService, private documentActions: DocumentActionsService) { - alfrescoSettingsService.ecmHost = this.ecmHost; + settingsService.ecmHost = this.ecmHost; if (this.authService.getTicket()) { this.token = this.authService.getTicket(); } @@ -166,7 +166,7 @@ class DocumentListDemo implements OnInit { } public updateHost(): void { - this.alfrescoSettingsService.ecmHost = this.ecmHost; + this.settingsService.ecmHost = this.ecmHost; this.login(); } diff --git a/ng2-components/ng2-alfresco-login/demo/src/main.ts b/ng2-components/ng2-alfresco-login/demo/src/main.ts index 6bfe71ab2b..318d25a2f3 100644 --- a/ng2-components/ng2-alfresco-login/demo/src/main.ts +++ b/ng2-components/ng2-alfresco-login/demo/src/main.ts @@ -65,12 +65,12 @@ export class AppComponent { public providers: string = 'ECM'; constructor(public auth: AlfrescoAuthenticationService, - private alfrescoSettingsService: AlfrescoSettingsService) { - alfrescoSettingsService.ecmHost = this.ecmHost; + private settingsService: AlfrescoSettingsService) { + settingsService.ecmHost = this.ecmHost; } public updateHost(): void { - this.alfrescoSettingsService.ecmHost = this.ecmHost; + this.settingsService.ecmHost = this.ecmHost; } mySuccessMethod($event) { diff --git a/ng2-components/ng2-alfresco-login/src/components/alfresco-login.component.ts b/ng2-components/ng2-alfresco-login/src/components/alfresco-login.component.ts index 1e4388f163..a0a67a46b2 100644 --- a/ng2-components/ng2-alfresco-login/src/components/alfresco-login.component.ts +++ b/ng2-components/ng2-alfresco-login/src/components/alfresco-login.component.ts @@ -69,12 +69,12 @@ export class AlfrescoLoginComponent { * Constructor * @param _fb * @param authService - * @param settingService + * @param settingsService * @param translate */ constructor(private _fb: FormBuilder, public authService: AlfrescoAuthenticationService, - public settingService: AlfrescoSettingsService, + public settingsService: AlfrescoSettingsService, private translate: AlfrescoTranslationService) { this.formError = { @@ -113,7 +113,7 @@ export class AlfrescoLoginComponent { event.preventDefault(); } - this.settingService.setProviders(this.providers); + this.settingsService.setProviders(this.providers); this.authService.login(value.username, value.password) .subscribe( diff --git a/ng2-components/ng2-alfresco-search/demo/src/main.ts b/ng2-components/ng2-alfresco-search/demo/src/main.ts index c9e6f7a702..fdffb9c8e1 100644 --- a/ng2-components/ng2-alfresco-search/demo/src/main.ts +++ b/ng2-components/ng2-alfresco-search/demo/src/main.ts @@ -63,16 +63,16 @@ class SearchDemo implements OnInit { token: string; constructor(private authService: AlfrescoAuthenticationService, - private alfrescoSettingsService: AlfrescoSettingsService, + private settingsService: AlfrescoSettingsService, translation: AlfrescoTranslationService) { - alfrescoSettingsService.ecmHost = this.ecmHost; + settingsService.ecmHost = this.ecmHost; translation.addTranslationFolder(); } public updateHost(): void { - this.alfrescoSettingsService.ecmHost = this.ecmHost; + this.settingsService.ecmHost = this.ecmHost; this.login(); } diff --git a/ng2-components/ng2-alfresco-upload/demo/src/main.ts b/ng2-components/ng2-alfresco-upload/demo/src/main.ts index b239fd9131..6f75c98ffe 100644 --- a/ng2-components/ng2-alfresco-upload/demo/src/main.ts +++ b/ng2-components/ng2-alfresco-upload/demo/src/main.ts @@ -80,8 +80,8 @@ export class MyDemoApp implements OnInit { token: string; - constructor(private authService: AlfrescoAuthenticationService, private alfrescoSettingsService: AlfrescoSettingsService) { - alfrescoSettingsService.ecmHost = this.ecmHost; + constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) { + settingsService.ecmHost = this.ecmHost; if (this.authService.getTicket()) { this.token = this.authService.getTicket(); @@ -93,7 +93,7 @@ export class MyDemoApp implements OnInit { } public updateHost(): void { - this.alfrescoSettingsService.ecmHost = this.ecmHost; + this.settingsService.ecmHost = this.ecmHost; this.login(); } diff --git a/ng2-components/ng2-alfresco-viewer/demo/src/main.ts b/ng2-components/ng2-alfresco-viewer/demo/src/main.ts index 1b28fad5ac..6515dec983 100644 --- a/ng2-components/ng2-alfresco-viewer/demo/src/main.ts +++ b/ng2-components/ng2-alfresco-viewer/demo/src/main.ts @@ -57,9 +57,9 @@ class MyDemoApp { token: string; constructor(private authService: AlfrescoAuthenticationService, - private alfrescoSettingsService: AlfrescoSettingsService) { + private settingsService: AlfrescoSettingsService) { - alfrescoSettingsService.ecmHost = this.ecmHost; + settingsService.ecmHost = this.ecmHost; if (this.authService.getTicket()) { this.token = this.authService.getTicket(); } @@ -70,7 +70,7 @@ class MyDemoApp { } public updateHost(): void { - this.alfrescoSettingsService.ecmHost = this.ecmHost; + this.settingsService.ecmHost = this.ecmHost; this.login(); } diff --git a/ng2-components/ng2-alfresco-webscript/demo/src/main.ts b/ng2-components/ng2-alfresco-webscript/demo/src/main.ts index 2b9edfe97c..1d554e2da7 100644 --- a/ng2-components/ng2-alfresco-webscript/demo/src/main.ts +++ b/ng2-components/ng2-alfresco-webscript/demo/src/main.ts @@ -34,9 +34,9 @@ import { WEBSCRIPTCOMPONENT } from 'ng2-alfresco-webscript';


-

+

- Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid token to perform + Authentication failed to ip {{ ecmHost }} with user: admin, admin, you can still try to add a valid token to perform operations.

@@ -76,10 +76,10 @@ class WebscriptDemo implements OnInit { token: string; constructor(private authService: AlfrescoAuthenticationService, - private alfrescoSettingsService: AlfrescoSettingsService) { + private settingsService: AlfrescoSettingsService) { - alfrescoSettingsService.ecmHost = this.ecmHost; - alfrescoSettingsService.setProviders('ECM'); + settingsService.ecmHost = this.ecmHost; + settingsService.setProviders('ECM'); if (this.authService.getTicket()) { this.token = this.authService.getTicket(); @@ -91,7 +91,7 @@ class WebscriptDemo implements OnInit { } public updateHost(): void { - this.alfrescoSettingsService.ecmHost = this.ecmHost; + this.settingsService.ecmHost = this.ecmHost; this.login(); }