Add the whole user configuration to the AppState

Closes #252
Fixes #219
This commit is contained in:
Farkas József
2017-02-07 23:43:34 +01:00
committed by József Farkas
parent e41a62be13
commit f1f8a8d64e
19 changed files with 374 additions and 525 deletions

View File

@@ -23,7 +23,7 @@ import { CaptureService } from '../../../../services/capture.service';
import { MapperService } from '../../../../services/mapper.service';
import { AppState } from '../../../../store/index';
import { getMacroEntities } from '../../../../store/reducers/macro';
import { getMacros } from '../../../../store/reducers/user-configuration';
enum LabelTypes {
KeystrokeKey,
@@ -146,7 +146,7 @@ export class SvgKeyboardKeyComponent implements OnInit, OnChanges, OnDestroy {
private captureService: CaptureService,
private renderer: Renderer
) {
this.subscription = store.let(getMacroEntities())
this.subscription = store.let(getMacros())
.subscribe((macros: Macro[]) => this.macros = macros);
this.reset();

View File

@@ -283,8 +283,8 @@ export class SvgKeyboardWrapComponent implements OnInit, OnChanges {
} else if (keyAction instanceof PlayMacroAction) {
const playMacroAction: PlayMacroAction = keyAction;
return this.store
.select(appState => appState.macros)
.map(macroState => macroState.entities.find(macro => {
.select(appState => appState.userConfiguration.macros)
.map(macroState => macroState.find(macro => {
return macro.id === playMacroAction.macroId;
}).name)
.map(macroName => {
@@ -303,7 +303,7 @@ export class SvgKeyboardWrapComponent implements OnInit, OnChanges {
} else if (keyAction instanceof SwitchKeymapAction) {
const switchKeymapAction: SwitchKeymapAction = keyAction;
return this.store
.select(appState => appState.keymaps.entities)
.select(appState => appState.userConfiguration.keymaps)
.map(keymaps => keymaps.find(keymap => keymap.abbreviation === switchKeymapAction.keymapAbbreviation).name)
.map(keymapName => {
const content: NameValuePair[] = [