Merge pull request #614 from Alfresco/dev-eromano-fixDemo

fix demo index
This commit is contained in:
Denys Vuika 2016-08-25 14:21:36 +01:00 committed by GitHub
commit 21cf149b9c
6 changed files with 77 additions and 74 deletions

View File

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

View File

@ -29,8 +29,8 @@ import {
@Component({ @Component({
selector: 'my-app', selector: 'my-app',
template: ` template: `
<label for="token"><b>Insert the ip of your Alfresco instance:</b></label><br> <label for="host"><b>Insert the ip of your Alfresco instance:</b></label><br>
<input id="token" type="text" size="48" (change)="updateHost()" [(ngModel)]="host"><br><br> <input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="ecmHost"><br><br>
<div style="border-radius: 8px; position: absolute; background-color: papayawhip; color: cadetblue; left: 10px; top: 120px; z-index: 1;"> <div style="border-radius: 8px; position: absolute; background-color: papayawhip; color: cadetblue; left: 10px; top: 120px; z-index: 1;">
<p style="width:120px;margin: 20px;"> <p style="width:120px;margin: 20px;">
<label for="switch1" class="mdl-switch mdl-js-switch mdl-js-ripple-effect"> <label for="switch1" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
@ -58,7 +58,7 @@ export class AppComponent {
public ecmHost: string = 'http://devproducts-platform.alfresco.me'; public ecmHost: string = 'http://devproducts-platform.alfresco.me';
public token: string; public ticket: string;
public status: string = ''; public status: string = '';

View File

@ -32,12 +32,12 @@ import {
@Component({ @Component({
selector: 'alfresco-search-demo', selector: 'alfresco-search-demo',
template: `<label for="token"><b>Insert a valid access token / ticket:</b></label><br> template: `<label for="ticket"><b>Insert a valid access ticket / ticket:</b></label><br>
<input id="token" type="text" size="48" (change)="updateToken()" [(ngModel)]="token"><br> <input id="ticket" type="text" size="48" (change)="updateticket()" [(ngModel)]="ticket"><br>
<label for="token"><b>Insert the ip of your Alfresco instance:</b></label><br> <label for="host"><b>Insert the ip of your Alfresco instance:</b></label><br>
<input id="token" type="text" size="48" (change)="updateHost()" [(ngModel)]="host"><br><br> <input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="ecmHost"><br><br>
<div *ngIf="!authenticated" style="color:#FF2323"> <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. operations.
</div> </div>
<hr> <hr>
@ -60,13 +60,14 @@ class SearchDemo implements OnInit {
public ecmHost: string = 'http://devproducts-platform.alfresco.me'; public ecmHost: string = 'http://devproducts-platform.alfresco.me';
token: string; ticket: string;
constructor(private authService: AlfrescoAuthenticationService, constructor(private authService: AlfrescoAuthenticationService,
private settingsService: AlfrescoSettingsService, private settingsService: AlfrescoSettingsService,
translation: AlfrescoTranslationService) { translation: AlfrescoTranslationService) {
settingsService.ecmHost = this.ecmHost; settingsService.ecmHost = this.ecmHost;
settingsService.setProviders('ECM');
translation.addTranslationFolder(); translation.addTranslationFolder();
} }
@ -82,9 +83,9 @@ class SearchDemo implements OnInit {
login() { login() {
this.authService.login('admin', 'admin').subscribe( this.authService.login('admin', 'admin').subscribe(
token => { ticket => {
console.log(token); console.log(ticket);
this.token = token; this.ticket = this.authService.getTicketEcm();
this.authenticated = true; this.authenticated = true;
}, },
error => { error => {

View File

@ -28,12 +28,12 @@ import { ALFRESCO_ULPOAD_COMPONENTS, UploadService } from 'ng2-alfresco-upload';
@Component({ @Component({
selector: 'my-app', selector: 'my-app',
template: `<label for="token"><b>Insert a valid access token / ticket:</b></label><br> template: `<label for="ticket"><b>Insert a valid access ticket / ticket:</b></label><br>
<input id="token" type="text" size="48" (change)="updateToken()" [(ngModel)]="token"><br> <input id="ticket" type="text" size="48" (change)="updateTicket()" [(ngModel)]="ticket"><br>
<label for="token"><b>Insert the ip of your Alfresco instance:</b></label><br> <label for="host"><b>Insert the ip of your Alfresco instance:</b></label><br>
<input id="token" type="text" size="48" (change)="updateHost()" [(ngModel)]="host"><br><br> <input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="ecmHost"><br><br>
<div *ngIf="!authenticated" style="color:#FF2323"> <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. operations.
</div> </div>
<hr> <hr>
@ -78,18 +78,19 @@ export class MyDemoApp implements OnInit {
public ecmHost: string = 'http://devproducts-platform.alfresco.me'; public ecmHost: string = 'http://devproducts-platform.alfresco.me';
token: string; ticket: string;
constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) { constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) {
settingsService.ecmHost = this.ecmHost; settingsService.ecmHost = this.ecmHost;
settingsService.setProviders('ECM');
if (this.authService.getTicket()) { if (this.authService.getTicketEcm()) {
this.token = this.authService.getTicket(); this.ticket = this.authService.getTicketEcm();
} }
} }
public updateToken(): void { public updateTicket(): void {
localStorage.setItem('token', this.token); localStorage.setItem('ticket-ECM', this.ticket);
} }
public updateHost(): void { public updateHost(): void {
@ -107,9 +108,9 @@ export class MyDemoApp implements OnInit {
login() { login() {
this.authService.login('admin', 'admin').subscribe( this.authService.login('admin', 'admin').subscribe(
token => { ticket => {
console.log(token); console.log(ticket);
this.token = token; this.ticket = this.authService.getTicketEcm();
this.authenticated = true; this.authenticated = true;
}, },
error => { error => {

View File

@ -30,12 +30,12 @@ import {
@Component({ @Component({
selector: 'my-app', selector: 'my-app',
template: ` template: `
<label for="token"><b>Insert a valid access token / ticket:</b></label><br> <label for="ticket"><b>Insert a valid access ticket / ticket:</b></label><br>
<input id="token" type="text" size="48" (change)="updateToken();documentList.reload()" [(ngModel)]="token"><br> <input id="ticket" type="text" size="48" (change)="updateTicket();documentList.reload()" [(ngModel)]="ticket"><br>
<label for="token"><b>Insert the ip of your Alfresco instance:</b></label><br> <label for="host"><b>Insert the ip of your Alfresco instance:</b></label><br>
<input id="token" type="text" size="48" (change)="updateHost();documentList.reload()" [(ngModel)]="ecmHost"><br><br> <input id="host" type="text" size="48" (change)="updateHost();documentList.reload()" [(ngModel)]="ecmHost"><br><br>
<div *ngIf="!authenticated" style="color:#FF2323"> <div *ngIf="!authenticated" style="color:#FF2323">
Authentication failed to ip {{ ecmHost }} 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 ticket to perform
operations. operations.
</div> </div>
<hr> <hr>
@ -54,19 +54,19 @@ class MyDemoApp {
ecmHost: string = 'http://127.0.0.1:8080'; ecmHost: string = 'http://127.0.0.1:8080';
token: string; ticket: string;
constructor(private authService: AlfrescoAuthenticationService, constructor(private authService: AlfrescoAuthenticationService,
private settingsService: AlfrescoSettingsService) { private settingsService: AlfrescoSettingsService) {
settingsService.ecmHost = this.ecmHost; settingsService.ecmHost = this.ecmHost;
if (this.authService.getTicket()) { if (this.authService.getTicketEcm()) {
this.token = this.authService.getTicket(); this.ticket = this.authService.getTicketEcm();
} }
} }
public updateToken(): void { public updateTicket(): void {
localStorage.setItem('token', this.token); localStorage.setItem('ticket-ECM', this.ticket);
} }
public updateHost(): void { public updateHost(): void {
@ -80,9 +80,9 @@ class MyDemoApp {
login() { login() {
this.authService.login('admin', 'admin').subscribe( this.authService.login('admin', 'admin').subscribe(
token => { ticket => {
console.log(token); console.log(ticket);
this.token = token; this.ticket = this.authService.getTicketEcm();
this.authenticated = true; this.authenticated = true;
}, },
error => { error => {

View File

@ -31,21 +31,21 @@ import { WEBSCRIPTCOMPONENT } from 'ng2-alfresco-webscript';
@Component({ @Component({
selector: 'alfresco-webscript-demo', selector: 'alfresco-webscript-demo',
template: ` template: `
<label for="token"><b>Insert a valid access token / ticket:</b></label><br> <label for="ticket"><b>Insert a valid access ticket / ticket:</b></label><br>
<input id="token" type="text" size="48" (change)="updateToken();documentList.reload()" [(ngModel)]="token"><br> <input id="ticket" type="text" size="48" (change)="updateTicket();documentList.reload()" [(ngModel)]="ticket"><br>
<label for="token"><b>Insert the ip of your Alfresco instance:</b></label><br> <label for="host"><b>Insert the ip of your Alfresco instance:</b></label><br>
<input id="token" type="text" size="48" (change)="updateHost();documentList.reload()" [(ngModel)]="ecmHost"><br><br> <input id="host" type="text" size="48" (change)="updateHost();documentList.reload()" [(ngModel)]="ecmHost"><br><br>
<div *ngIf="!authenticated" style="color:#FF2323"> <div *ngIf="!authenticated" style="color:#FF2323">
Authentication failed to ip {{ ecmHost }} 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 ticket to perform
operations. operations.
</div> </div>
<hr> <hr>
<label for="token"><b>Insert a scriptPath</b></label><br> <label for="scriptPath"><b>Insert a scriptPath</b></label><br>
<input id="token" type="text" size="48" [(ngModel)]="scriptPath"><br> <input id="scriptPath" type="text" size="48" [(ngModel)]="scriptPath"><br>
<label for="token"><b>Insert a contextRoot</b></label><br> <label for="contextRoot"><b>Insert a contextRoot</b></label><br>
<input id="token" type="text" size="48" [(ngModel)]="contextRoot"><br> <input id="contextRoot" type="text" size="48" [(ngModel)]="contextRoot"><br>
<label for="token"><b>Insert a servicePath</b></label><br> <label for="servicePath"><b>Insert a servicePath</b></label><br>
<input id="token" type="text" size="48" [(ngModel)]="servicePath"><br> <input id="servicePath" type="text" size="48" [(ngModel)]="servicePath"><br>
<div class="container" *ngIf="authenticated"> <div class="container" *ngIf="authenticated">
<alfresco-webscript-get [scriptPath]="scriptPath" <alfresco-webscript-get [scriptPath]="scriptPath"
[scriptArgs]="scriptArgs" [scriptArgs]="scriptArgs"
@ -73,7 +73,7 @@ class WebscriptDemo implements OnInit {
scriptArgs: string = ''; scriptArgs: string = '';
token: string; ticket: string;
constructor(private authService: AlfrescoAuthenticationService, constructor(private authService: AlfrescoAuthenticationService,
private settingsService: AlfrescoSettingsService) { private settingsService: AlfrescoSettingsService) {
@ -81,13 +81,13 @@ class WebscriptDemo implements OnInit {
settingsService.ecmHost = this.ecmHost; settingsService.ecmHost = this.ecmHost;
settingsService.setProviders('ECM'); settingsService.setProviders('ECM');
if (this.authService.getTicket()) { if (this.authService.getTicketEcm()) {
this.token = this.authService.getTicket(); this.ticket = this.authService.getTicketEcm();
} }
} }
public updateToken(): void { public updateTicket(): void {
localStorage.setItem('token', this.token); localStorage.setItem('ticket-ECM', this.ticket);
} }
public updateHost(): void { public updateHost(): void {
@ -101,9 +101,9 @@ class WebscriptDemo implements OnInit {
login() { login() {
this.authService.login('admin', 'admin').subscribe( this.authService.login('admin', 'admin').subscribe(
token => { ticket => {
console.log(token); console.log(ticket);
this.token = token; this.ticket = this.authService.getTicketEcm();
this.authenticated = true; this.authenticated = true;
}, },
error => { error => {