mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
add host and token to document list demo
This commit is contained in:
@@ -36,8 +36,19 @@ import {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'alfresco-documentlist-demo',
|
selector: 'alfresco-documentlist-demo',
|
||||||
template: `
|
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">
|
<div class="container">
|
||||||
<alfresco-document-list *ngIf="authenticated">
|
|
||||||
|
<alfresco-document-list #doclist>
|
||||||
|
|
||||||
<content-columns>
|
<content-columns>
|
||||||
<content-column source="$thumbnail"></content-column>
|
<content-column source="$thumbnail"></content-column>
|
||||||
<content-column
|
<content-column
|
||||||
@@ -124,9 +135,6 @@ import {
|
|||||||
</content-action>
|
</content-action>
|
||||||
</content-actions>
|
</content-actions>
|
||||||
</alfresco-document-list>
|
</alfresco-document-list>
|
||||||
<div *ngIf="!authenticated">
|
|
||||||
Authentication failed to ip {{ host }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
styles: [':host > .container {padding: 10px}'],
|
styles: [':host > .container {padding: 10px}'],
|
||||||
@@ -140,17 +148,33 @@ class DocumentListDemo implements OnInit {
|
|||||||
|
|
||||||
host: string = 'http://192.168.99.100:8080';
|
host: string = 'http://192.168.99.100:8080';
|
||||||
|
|
||||||
|
token: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private authService: AlfrescoAuthenticationService,
|
private authService: AlfrescoAuthenticationService,
|
||||||
settings: AlfrescoSettingsService,
|
private alfrescoSettingsService: AlfrescoSettingsService,
|
||||||
translation: AlfrescoTranslationService,
|
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();
|
translation.translationInit();
|
||||||
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
|
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() {
|
ngOnInit() {
|
||||||
this.login();
|
this.login();
|
||||||
}
|
}
|
||||||
|
@@ -97,6 +97,9 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit,
|
|||||||
direction: 'asc'
|
direction: 'asc'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private _alfrescoService: AlfrescoService) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether navigation to parent folder is available.
|
* Determines whether navigation to parent folder is available.
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
@@ -106,9 +109,6 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit,
|
|||||||
this.currentFolderPath !== this.rootFolder.path;
|
this.currentFolderPath !== this.rootFolder.path;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
|
||||||
private _alfrescoService: AlfrescoService) {}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.changePath(this.currentFolderPath);
|
this.changePath(this.currentFolderPath);
|
||||||
}
|
}
|
||||||
|
@@ -92,6 +92,7 @@ export class MyDemoApp implements OnInit {
|
|||||||
|
|
||||||
public updateHost(): void {
|
public updateHost(): void {
|
||||||
this.alfrescoSettingsService.host = this.host;
|
this.alfrescoSettingsService.host = this.host;
|
||||||
|
this.login();
|
||||||
}
|
}
|
||||||
|
|
||||||
public customMethod(event: Object): void {
|
public customMethod(event: Object): void {
|
||||||
|
Reference in New Issue
Block a user