Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #15 from NordicSemiconductor/fix/splitting
Browse files Browse the repository at this point in the history
Add new credential types to certificate manager
  • Loading branch information
bencefr authored Aug 15, 2019
2 parents 8752faa + a00f57e commit 723d99e
Show file tree
Hide file tree
Showing 12 changed files with 233 additions and 207 deletions.
23 changes: 20 additions & 3 deletions index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

import React from 'react';
import SidePanel from './lib/components/SidePanel';
import MainView from './lib/containers/MainView';
import MainView from './lib/components/MainView';
import NavMenu from './lib/containers/NavMenu';
import './resources/css/index.scss';

Expand Down Expand Up @@ -129,8 +129,25 @@ export default {
dispatch(loadCommands());
dispatch(loadSettings());
},
decorateMainView: () => () => <MainView />,
decorateNavMenu: () => () => <NavMenu />,
mapMainViewState: ({ core }, props) => ({
...props,
viewId: core.navMenu.selectedItemId < 0 ? 1 : core.navMenu.selectedItemId,
}),
decorateMainView: () => props => <MainView {...props} />,
decorateNavMenu: CoreNavMenu => ({ selectedItemId, ...rest }) => (
<>
<NavMenu />
<CoreNavMenu
{...rest}
selectedItemId={selectedItemId < 0 ? 1 : selectedItemId}
menuItems={[
{ id: 0, text: 'Chart', iconClass: 'mdi mdi-chart-bell-curve' },
{ id: 1, text: 'Terminal', iconClass: 'mdi mdi-console' },
{ id: 2, text: 'Certificate manager', iconClass: 'mdi mdi-certificate' },
]}
/>
</>
),
mapDeviceSelectorState: (state, props) => ({
autoDeviceFilter: state.app.ui.autoDeviceFilter,
portIndicatorStatus: (state.app.modemPort.deviceName !== null) ? 'on' : 'off',
Expand Down
9 changes: 9 additions & 0 deletions lib/actions/modemActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,15 @@ export function writeTLSCredential(secTag, type, content, password) {
};
}

export function deleteTLSCredential(secTag, type) {
return async () => {
if (!port) {
throw new Error('Device is not open.');
}
return port.deleteTLSCredential(secTag, type);
};
}

export function close() {
return async () => {
if (port && port.isOpen) {
Expand Down
31 changes: 1 addition & 30 deletions lib/actions/uiActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,14 @@
*/

import {
SET_MAIN_VIEW, TERMINAL_AUTO_SCROLL,
TERMINAL_AUTO_SCROLL,
API_TOKEN_UPDATE, AUTO_REQUESTS,
SIGNAL_QUALITY_INTERVAL,
AUTO_DEVICE_FILTER_TOGGLED,
} from './actionIds';
import { changeSignalQualityInterval } from './modemActions';
import persistentStore from './persistentStore';

export const MAIN_VIEW_CHART = 'MAIN_VIEW_CHART';
export const MAIN_VIEW_TERMINAL = 'MAIN_VIEW_TERMINAL';
export const MAIN_VIEW_CERTMGR = 'MAIN_VIEW_CERTMGR';

function setMainViewAction(mainView) {
return {
type: SET_MAIN_VIEW,
mainView,
};
}

export function autoScrollToggledAction(autoScroll) {
persistentStore.set('autoScroll', !!autoScroll);
return {
Expand All @@ -62,24 +51,6 @@ export function autoScrollToggledAction(autoScroll) {
};
}

export function setChartView() {
return dispatch => {
dispatch(setMainViewAction(MAIN_VIEW_CHART));
};
}

export function setTerminalView() {
return dispatch => {
dispatch(setMainViewAction(MAIN_VIEW_TERMINAL));
};
}

export function setCertManagerView() {
return dispatch => {
dispatch(setMainViewAction(MAIN_VIEW_CERTMGR));
};
}

export function apiTokenUpdateAction(apiToken) {
persistentStore.set('apiToken', apiToken);
return {
Expand Down
Loading

0 comments on commit 723d99e

Please sign in to comment.