refactore: create feature modules (#387)

* add @angular/cli to the project

* increase nodejs version -> 8.2.1

* add lerna

* merge web and shared module

* move electron module into packages as uhk-agent

Electron agent functionality is not working

* delete symlinker

* convert private properties to public of component if used in html

* revert uhk-message.component

* fix component path

* fix the correct name of the uhk-message.component.scss

* building web and electron module

* delete uhk-renderer package

* handle device connect disconnect state

* add privilege detection

* fix set privilege functionality

* turn back download keymap functionality

* add bootstrap, select2 js and fix null pointer exception

* turn back upload data to keyboard

* fix send keymap

* fix test-serializer

* add missing package.json

* merging

* fix appveyor build

* fix linting

* turn back electron storage service

* commit the missing electron-datastorage-repository

* update node to 8.3.0 in .nvmrc and log node version in appveyor build

* set exact version number in appveyor build

* vertical align privilege and missing device components

* set back node version to 8 in appveyor

* move node-usb dependency from usb dir to root

maybe it is fix the appveyor build

* revert usb to root

* fix electron builder script

* fix electron builder script

* turn off electron devtools

* remove CTRL+U functionality

* fix CTRL+o

* fix lint error

* turnoff store freeze

* start process when got `Error: EPERM: operation not permitted` error

* move files from root usb dir -> packages/usb
This commit is contained in:
Róbert Kiss
2017-08-19 20:02:17 +02:00
committed by László Monda
parent 97770f67c0
commit 0f558e4132
524 changed files with 25606 additions and 5036 deletions

View File

@@ -0,0 +1,91 @@
import { routerActions } from '@ngrx/router-store';
import { Action } from '@ngrx/store';
import { runInElectron, Notification, NotificationType } from 'uhk-common';
import { ActionTypes, ShowNotificationAction } from '../actions/app';
import { ActionTypes as UserConfigActionTypes } from '../actions/user-config';
import { UserConfiguration } from '../../config-serializer/config-items/user-configuration';
export interface State {
started: boolean;
showAddonMenu: boolean;
undoableNotification?: Notification;
navigationCountAfterNotification: number;
prevUserConfig?: UserConfiguration;
runningInElectron: boolean;
}
const initialState: State = {
started: false,
showAddonMenu: false,
navigationCountAfterNotification: 0,
runningInElectron: runInElectron()
};
export function reducer(state = initialState, action: Action) {
switch (action.type) {
case ActionTypes.APP_STARTED: {
return {
...state,
started: true
};
}
case ActionTypes.APP_TOGGLE_ADDON_MENU: {
return {
...state,
showAddonMenu: action.payload
};
}
case ActionTypes.APP_SHOW_NOTIFICATION: {
const currentAction = <ShowNotificationAction>action;
if (currentAction.payload.type !== NotificationType.Undoable) {
return state;
}
return {
...state,
undoableNotification: currentAction.payload,
navigationCountAfterNotification: 0
};
}
// Required to dismiss the undoNotification dialog, when user navigate in the app.
// When deleted a keymap or macro the app automaticaly navigate to other keymap, or macro, so
// so we have to count the navigations and when reach the 2nd then remove the dialog.
case routerActions.UPDATE_LOCATION: {
const newState = { ...state };
newState.navigationCountAfterNotification++;
if (newState.navigationCountAfterNotification > 1) {
newState.undoableNotification = null;
}
return newState;
}
case ActionTypes.UNDO_LAST_SUCCESS:
case ActionTypes.DISMISS_UNDO_NOTIFICATION: {
return {
...state,
undoableNotification: null
};
}
case UserConfigActionTypes.LOAD_USER_CONFIG_SUCCESS:
case UserConfigActionTypes.SAVE_USER_CONFIG_SUCCESS: {
return {
...state,
prevUserConfig: action.payload
};
}
default:
return state;
}
}
export const showAddonMenu = (state: State) => state.showAddonMenu;
export const getUndoableNotification = (state: State) => state.undoableNotification;
export const getPrevUserConfiguration = (state: State) => state.prevUserConfig;
export const runningInElectron = (state: State) => state.runningInElectron;