[ACA-1430] Initial NgRx setup (#384)

* initial ngrx integration, migrate header

* update header tests

* update spellcheck rules

* fix locked image path for virtual paths
This commit is contained in:
Denys Vuika
2018-06-04 08:57:50 +01:00
committed by Cilibiu Bogdan
parent c9cd7ae5c4
commit a67dd43ad6
15 changed files with 198 additions and 35 deletions

View File

@@ -30,6 +30,11 @@ import {
FileModel, UploadService
} from '@alfresco/adf-core';
import { ElectronService } from '@ngstack/electron';
import { Store } from '@ngrx/store';
import { AcaState } from './store/states/app.state';
import { SetHeaderColorAction } from './store/actions/header-color.action';
import { SetAppNameAction } from './store/actions/app-name.action';
import { SetLogoPathAction } from './store/actions/logo-path.action';
@Component({
selector: 'app-root',
@@ -42,7 +47,8 @@ export class AppComponent implements OnInit {
private router: Router,
private pageTitle: PageTitleService,
preferences: UserPreferencesService,
config: AppConfigService,
private store: Store<AcaState>,
private config: AppConfigService,
private electronService: ElectronService,
private uploadService: UploadService) {
// TODO: remove once ADF 2.3.0 is out (needs bug fixes)
@@ -51,6 +57,9 @@ export class AppComponent implements OnInit {
}
ngOnInit() {
this.loadAppSettings();
const { router, pageTitle, route } = this;
router
@@ -89,4 +98,19 @@ export class AppComponent implements OnInit {
}
});
}
private loadAppSettings() {
const headerColor = this.config.get<string>('headerColor');
if (headerColor) {
this.store.dispatch(new SetHeaderColorAction(headerColor));
}
const appName = this.config.get<string>('application.name');
if (appName) {
this.store.dispatch(new SetAppNameAction(appName));
}
const logoPath = this.config.get<string>('application.logo');
if (logoPath) {
this.store.dispatch(new SetLogoPathAction(logoPath));
}
}
}