add host and token to document list demo

This commit is contained in:
Mario Romano
2016-06-02 17:03:39 +01:00
parent f9aa5067cd
commit 956f8e9e81
3 changed files with 35 additions and 10 deletions

View File

@@ -36,8 +36,19 @@ import {
@Component({
selector: 'alfresco-documentlist-demo',
template: `
<label for="token"><b>Insert a valid access token / ticket:</b></label><br>
<input id="token" type="text" size="48" (change)="updateToken();doclist.reload()" [(ngModel)]="token"><br>
<label for="token"><b>Insert the ip of your Alfresco instance:</b></label><br>
<input id="token" type="text" size="48" (change)="updateHost();doclist.reload()" [(ngModel)]="host"><br><br>
<div *ngIf="!authenticated" style="color:#FF2323">
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid token to perform
operations.
</div>
<hr>
<div class="container">
<alfresco-document-list *ngIf="authenticated">
<alfresco-document-list #doclist>
<content-columns>
<content-column source="$thumbnail"></content-column>
<content-column
@@ -124,9 +135,6 @@ import {
</content-action>
</content-actions>
</alfresco-document-list>
<div *ngIf="!authenticated">
Authentication failed to ip {{ host }}
</div>
</div>
`,
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();
}

View File

@@ -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);
}

View File

@@ -92,6 +92,7 @@ export class MyDemoApp implements OnInit {
public updateHost(): void {
this.alfrescoSettingsService.host = this.host;
this.login();
}
public customMethod(event: Object): void {