Agent menu (#540)

* Add generate version module script

* Remove Fork me on GitHub banner

* Add app-version.ts

* Revert "Add app-version.ts"

This reverts commit fe1a37e631.

* Add app-version.ts

* Add agent icon class

* Move settings component under agent folder

* Add AboutComponent

* Add agent routes

* Add index.ts for agent folder

* Fix agent folder imports in shared module

* Add agent menu to side menu, with Settings and About pages under it

* Fix agent icon alignment in side menu

* Simplify About page

* Make Agent menu 0 level in side menu

* Remove bottom Settings menu

* Fix Agent menu closing if My UHK is closed in side menu

* Fix version text alignment in auto update settings

* Remove github fork ribbon styles

* use package.json instead of app-version.ts

* fix OpenUrlInNewWindow naming

* fix lint request

* fix: firmware download url calculation
This commit is contained in:
Mikko Lakomaa
2018-01-13 17:10:21 +01:00
committed by László Monda
parent fdcf64d5c6
commit 3ee6c680a1
34 changed files with 199 additions and 137 deletions
+10 -10
View File
@@ -1,6 +1,6 @@
import { Action } from '@ngrx/store';
import { AppStartInfo, CommandLineArgs, HardwareConfiguration, Notification, type, VersionInformation } from 'uhk-common';
import { AppStartInfo, CommandLineArgs, HardwareConfiguration, Notification, type } from 'uhk-common';
import { ElectronLogEntry } from '../../models/xterm-log';
const PREFIX = '[app] ';
@@ -16,8 +16,8 @@ export const ActionTypes = {
UNDO_LAST_SUCCESS: type(PREFIX + 'undo last action success'),
DISMISS_UNDO_NOTIFICATION: type(PREFIX + 'dismiss notification action'),
LOAD_HARDWARE_CONFIGURATION_SUCCESS: type(PREFIX + 'load hardware configuration success'),
UPDATE_AGENT_VERSION_INFORMATION: type(PREFIX + 'update agent version information'),
ELECTRON_MAIN_LOG_RECEIVED: type(PREFIX + 'Electron main log received')
ELECTRON_MAIN_LOG_RECEIVED: type(PREFIX + 'Electron main log received'),
OPEN_URL_IN_NEW_WINDOW: type(PREFIX + 'Open URL in new Window')
};
export class AppBootsrappedAction implements Action {
@@ -66,18 +66,18 @@ export class LoadHardwareConfigurationSuccessAction implements Action {
constructor(public payload: HardwareConfiguration) {}
}
export class UpdateAgentVersionInformationAction implements Action {
type = ActionTypes.UPDATE_AGENT_VERSION_INFORMATION;
constructor(public payload: VersionInformation) {}
}
export class ElectronMainLogReceivedAction implements Action {
type = ActionTypes.ELECTRON_MAIN_LOG_RECEIVED;
constructor(public payload: ElectronLogEntry) {}
}
export class OpenUrlInNewWindowAction implements Action {
type = ActionTypes.OPEN_URL_IN_NEW_WINDOW;
constructor(public payload: string) {}
}
export type Actions
= AppStartedAction
| AppBootsrappedAction
@@ -88,6 +88,6 @@ export type Actions
| UndoLastSuccessAction
| DismissUndoNotificationAction
| LoadHardwareConfigurationSuccessAction
| UpdateAgentVersionInformationAction
| ElectronMainLogReceivedAction
| OpenUrlInNewWindowAction
;
+18 -10
View File
@@ -16,19 +16,15 @@ import {
ApplyCommandLineArgsAction,
AppStartedAction,
DismissUndoNotificationAction,
OpenUrlInNewWindowAction,
ProcessAppStartInfoAction,
ShowNotificationAction,
UndoLastAction,
UpdateAgentVersionInformationAction
UndoLastAction
} from '../actions/app';
import { AppRendererService } from '../../services/app-renderer.service';
import { AppUpdateRendererService } from '../../services/app-update-renderer.service';
import {
ActionTypes as DeviceActions,
ConnectionStateChangedAction,
SaveToKeyboardSuccessAction
} from '../actions/device';
import { AppState, autoWriteUserConfiguration } from '../index';
import { ActionTypes as DeviceActions, ConnectionStateChangedAction, SaveToKeyboardSuccessAction } from '../actions/device';
import { AppState, autoWriteUserConfiguration, runningInElectron } from '../index';
@Injectable()
export class ApplicationEffects {
@@ -66,8 +62,7 @@ export class ApplicationEffects {
new ConnectionStateChangedAction({
connected: appInfo.deviceConnected,
hasPermission: appInfo.hasPermission
}),
new UpdateAgentVersionInformationAction(appInfo.agentVersionInfo)
})
];
});
@@ -85,6 +80,19 @@ export class ApplicationEffects {
}
});
@Effect({dispatch: false}) openUrlInNewWindow$ = this.actions$
.ofType<OpenUrlInNewWindowAction>(ActionTypes.OPEN_URL_IN_NEW_WINDOW)
.withLatestFrom(this.store.select(runningInElectron))
.do(([action, inElectron]) => {
const url = action.payload;
if (inElectron) {
this.appRendererService.openUrl(url);
} else {
window.open(url, '_blank');
}
});
constructor(private actions$: Actions,
private notifierService: NotifierService,
private appUpdateRendererService: AppUpdateRendererService,
@@ -7,6 +7,7 @@ import { ActionTypes, ShowNotificationAction } from '../actions/app';
import { ActionTypes as UserConfigActionTypes } from '../actions/user-config';
import { ActionTypes as DeviceActionTypes } from '../actions/device';
import { KeyboardLayout } from '../../keyboard/keyboard-layout.enum';
import { getVersions } from '../../util';
export interface State {
started: boolean;
@@ -27,7 +28,8 @@ export const initialState: State = {
autoWriteUserConfiguration: false,
navigationCountAfterNotification: 0,
runningInElectron: runInElectron(),
configLoading: true
configLoading: true,
agentVersionInfo: getVersions()
};
export function reducer(state = initialState, action: Action & { payload: any }) {
@@ -116,11 +118,6 @@ export function reducer(state = initialState, action: Action & { payload: any })
};
}
case ActionTypes.UPDATE_AGENT_VERSION_INFORMATION:
return {
...state,
agentVersionInfo: action.payload
};
default:
return state;
}