fix demo index

This commit is contained in:
Eugenio Romano
2016-08-25 11:47:49 +01:00
parent bec481e81e
commit 4406024330
6 changed files with 77 additions and 74 deletions

View File

@@ -37,12 +37,12 @@ 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();documentList.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();documentList.reload()" [(ngModel)]="host"><br><br>
<label for="ticket"><b>Insert a valid access ticket / ticket:</b></label><br>
<input id="ticket" type="text" size="48" (change)="updateTicket();documentList.reload()" [(ngModel)]="ticket"><br>
<label for="host"><b>Insert the ip of your Alfresco instance:</b></label><br>
<input id="host" type="text" size="48" (change)="updateHost();documentList.reload()" [(ngModel)]="ecmHost"><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
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid ticket to perform
operations.
</div>
<hr>
@@ -145,24 +145,25 @@ class DocumentListDemo implements OnInit {
ecmHost: string = 'http://devproducts-platform.alfresco.me';
token: string;
ticket: string;
constructor(
private authService: AlfrescoAuthenticationService,
private settingsService: AlfrescoSettingsService,
translation: AlfrescoTranslationService,
private documentActions: DocumentActionsService) {
private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService,
translation: AlfrescoTranslationService, private documentActions: DocumentActionsService) {
settingsService.ecmHost = this.ecmHost;
if (this.authService.getTicket()) {
this.token = this.authService.getTicket();
settingsService.setProviders('ECM');
if (this.authService.getTicketEcm()) {
this.ticket = this.authService.getTicketEcm();
}
translation.addTranslationFolder();
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
}
public updateToken(): void {
localStorage.setItem('token', this.token);
public updateTicket(): void {
localStorage.setItem('ticket-ECM', this.ticket);
}
public updateHost(): void {
@@ -190,9 +191,9 @@ class DocumentListDemo implements OnInit {
login() {
this.authService.login('admin', 'admin').subscribe(
token => {
console.log(token);
this.token = token;
ticket => {
console.log(ticket);
this.ticket = this.authService.getTicketEcm();
this.authenticated = true;
},
error => {