committed by
József Farkas
parent
9b2aa188e6
commit
de38e9c06e
@@ -36,7 +36,7 @@ export class MacroHeaderComponent implements AfterViewInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeMacro() {
|
removeMacro() {
|
||||||
this.store.dispatch(MacroActions.removeMacro(this.macro));
|
this.store.dispatch(MacroActions.removeMacro(this.macro.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
duplicateMacro() {
|
duplicateMacro() {
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ export namespace MacroActions {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function removeMacro(macro: Macro): Action {
|
export function removeMacro(macroId: number): Action {
|
||||||
return {
|
return {
|
||||||
type: MacroActions.REMOVE,
|
type: MacroActions.REMOVE,
|
||||||
payload: macro
|
payload: macroId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,12 +97,11 @@ export default function (state = initialState, action: Action): KeymapState {
|
|||||||
filtered[0].isDefault = true;
|
filtered[0].isDefault = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const deletedKeymap = state.entities.find(keymap => keymap.abbreviation === action.payload);
|
|
||||||
// Check for the deleted keymap in other keymaps
|
// Check for the deleted keymap in other keymaps
|
||||||
newState = filtered.map((keymap: Keymap) => {
|
newState = filtered.map((keymap: Keymap) => {
|
||||||
changedKeymap = new Keymap();
|
changedKeymap = new Keymap();
|
||||||
Object.assign(changedKeymap, keymap);
|
Object.assign(changedKeymap, keymap);
|
||||||
changedKeymap.layers = checkExistence(changedKeymap.layers, 'keymap', deletedKeymap);
|
changedKeymap.layers = checkExistence(changedKeymap.layers, 'keymapAbbreviation', action.payload);
|
||||||
|
|
||||||
return changedKeymap;
|
return changedKeymap;
|
||||||
});
|
});
|
||||||
@@ -148,7 +147,7 @@ export default function (state = initialState, action: Action): KeymapState {
|
|||||||
newState = state.entities.map((keymap: Keymap) => {
|
newState = state.entities.map((keymap: Keymap) => {
|
||||||
changedKeymap = new Keymap();
|
changedKeymap = new Keymap();
|
||||||
Object.assign(changedKeymap, keymap);
|
Object.assign(changedKeymap, keymap);
|
||||||
changedKeymap.layers = checkExistence(changedKeymap.layers, 'macro', action.payload);
|
changedKeymap.layers = checkExistence(changedKeymap.layers, '_macroId', action.payload);
|
||||||
|
|
||||||
return changedKeymap;
|
return changedKeymap;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export default function (state = initialState, action: Action): MacroState {
|
|||||||
};
|
};
|
||||||
|
|
||||||
case MacroActions.REMOVE:
|
case MacroActions.REMOVE:
|
||||||
newState = state.entities.filter((macro: Macro) => macro !== action.payload);
|
newState = state.entities.filter((macro: Macro) => macro.id !== action.payload);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
entities: newState
|
entities: newState
|
||||||
|
|||||||
Reference in New Issue
Block a user