move settings in another page and hide the bar if you are not logged in #908

This commit is contained in:
Eugenio Romano
2016-11-01 14:12:37 +00:00
parent 2959db79c6
commit 62abe21063
11 changed files with 235 additions and 90 deletions

View File

@@ -19,9 +19,9 @@ import { Component } from '@angular/core';
import { Router } from '@angular/router';
import {
AlfrescoSettingsService,
AlfrescoTranslationService,
AlfrescoAuthenticationService
AlfrescoAuthenticationService,
AlfrescoSettingsService
} from 'ng2-alfresco-core';
declare var document: any;
@@ -40,29 +40,16 @@ export class AppComponent {
constructor(public auth: AlfrescoAuthenticationService,
public router: Router,
translate: AlfrescoTranslationService,
public alfrescoSettingsService: AlfrescoSettingsService) {
public alfrescoSettingsService: AlfrescoSettingsService,
translate: AlfrescoTranslationService) {
this.setEcmHost();
this.setBpmHost();
this.setProvider();
this.translate = translate;
this.translate.addTranslationFolder();
}
public onChangeECMHost(event: KeyboardEvent): void {
console.log((<HTMLInputElement>event.target).value);
this.ecmHost = (<HTMLInputElement>event.target).value;
this.alfrescoSettingsService.ecmHost = this.ecmHost;
localStorage.setItem(`ecmHost`, this.ecmHost);
}
public onChangeBPMHost(event: KeyboardEvent): void {
console.log((<HTMLInputElement>event.target).value);
this.bpmHost = (<HTMLInputElement>event.target).value;
this.alfrescoSettingsService.bpmHost = this.bpmHost;
localStorage.setItem(`bpmHost`, this.bpmHost);
}
isLoggedIn(): boolean {
return this.auth.isLoggedIn();
}
@@ -120,4 +107,10 @@ export class AppComponent {
this.alfrescoSettingsService.bpmHost = this.bpmHost;
}
}
private setProvider() {
if (localStorage.getItem(`providers`)) {
this.alfrescoSettingsService.setProviders(localStorage.getItem(`providers`));
}
}
}