diff --git a/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts b/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts index 017718c31b..68404f1a46 100644 --- a/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts +++ b/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts @@ -36,8 +36,19 @@ import { @Component({ selector: 'alfresco-documentlist-demo', template: ` +
+
+
+

+
+ Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid token to perform + operations. +
+
- + + + -
- Authentication failed to ip {{ host }} -
`, styles: [':host > .container {padding: 10px}'], @@ -140,17 +148,33 @@ class DocumentListDemo implements OnInit { host: string = 'http://192.168.99.100:8080'; + token: string; + constructor( private authService: AlfrescoAuthenticationService, - settings: AlfrescoSettingsService, + private alfrescoSettingsService: AlfrescoSettingsService, translation: AlfrescoTranslationService, - documentActions: DocumentActionsService) { + private documentActions: DocumentActionsService) { + + alfrescoSettingsService.host = this.host; + + if (localStorage.getItem('token')) { + this.token = localStorage.getItem('token'); + } - settings.host = this.host; translation.translationInit(); documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this)); } + public updateToken(): void { + localStorage.setItem('token', this.token); + } + + public updateHost(): void { + this.alfrescoSettingsService.host = this.host; + this.login(); + } + ngOnInit() { this.login(); } diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts index f86a387bfa..a83c4f4ea2 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts @@ -97,6 +97,9 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit, direction: 'asc' }; + constructor( + private _alfrescoService: AlfrescoService) {} + /** * Determines whether navigation to parent folder is available. * @returns {boolean} @@ -106,9 +109,6 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit, this.currentFolderPath !== this.rootFolder.path; } - constructor( - private _alfrescoService: AlfrescoService) {} - ngOnInit() { this.changePath(this.currentFolderPath); } diff --git a/ng2-components/ng2-alfresco-upload/demo/src/main.ts b/ng2-components/ng2-alfresco-upload/demo/src/main.ts index a90b91a14e..8857d91fb3 100644 --- a/ng2-components/ng2-alfresco-upload/demo/src/main.ts +++ b/ng2-components/ng2-alfresco-upload/demo/src/main.ts @@ -92,6 +92,7 @@ export class MyDemoApp implements OnInit { public updateHost(): void { this.alfrescoSettingsService.host = this.host; + this.login(); } public customMethod(event: Object): void {