aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web/src/js/components/Header.js6
-rw-r--r--web/src/js/ducks/index.js2
-rw-r--r--web/src/js/ducks/ui.js25
3 files changed, 19 insertions, 14 deletions
diff --git a/web/src/js/components/Header.js b/web/src/js/components/Header.js
index 15d33ab3..8aaa6411 100644
--- a/web/src/js/components/Header.js
+++ b/web/src/js/components/Header.js
@@ -25,13 +25,13 @@ class Header extends Component {
}
render() {
- const { settings, updateLocation, query, selectedFlow, active_menu} = this.props
+ const { settings, updateLocation, query, selectedFlow, activeMenu} = this.props
let entries = [...Header.entries]
if(selectedFlow)
entries.push(FlowMenu)
- const Active = _.find(entries, (e) => e.title == active_menu)
+ const Active = _.find(entries, (e) => e.title == activeMenu)
return (
<header>
@@ -60,7 +60,7 @@ class Header extends Component {
export default connect(
(state) => ({
selectedFlow: state.flows.selected[0],
- active_menu: state.ui.active_menu
+ activeMenu: state.ui.activeMenu
}),
dispatch => bindActionCreators({
setActiveMenu,
diff --git a/web/src/js/ducks/index.js b/web/src/js/ducks/index.js
index f4ce8fa6..fee4d792 100644
--- a/web/src/js/ducks/index.js
+++ b/web/src/js/ducks/index.js
@@ -2,7 +2,7 @@ import {combineReducers} from 'redux'
import eventLog from './eventLog'
import websocket from './websocket'
import flows from './flows'
-import ui from './ui.js'
+import ui from './ui'
const rootReducer = combineReducers({
eventLog,
diff --git a/web/src/js/ducks/ui.js b/web/src/js/ducks/ui.js
index 26420e0d..28a13ea4 100644
--- a/web/src/js/ducks/ui.js
+++ b/web/src/js/ducks/ui.js
@@ -3,23 +3,28 @@ const SET_ACTIVE_MENU = 'SET_ACTIVE_MENU'
const defaultState = {
- active_menu: 'Start'
+ activeMenu: 'Start',
}
export default function reducer(state = defaultState, action) {
switch (action.type) {
case SET_ACTIVE_MENU:
return {
...state,
- active_menu: action.active_menu
+ activeMenu: action.activeMenu
}
case SELECT_FLOW:
- let isNewSelection = (action.flowId && !action.currentSelection)
- let isSelectAction = action.flowId
- if (isNewSelection){
- let wasFlowSelected = state.active_menu == 'Flow'
- return{
+ let isNewSelect = (action.flowId && !action.currentSelection)
+ let isDeselect = (!action.flowId && action.currentSelection)
+ if(isNewSelect) {
+ return {
...state,
- active_menu: isSelectAction ? 'Flow' : (wasFlowSelected ? 'Start' : state.active_menu)
+ activeMenu: "Flow"
+ }
+ }
+ if(isDeselect && state.activeMenu === "Flow") {
+ return {
+ ...state,
+ activeMenu: "Start"
}
}
return state
@@ -28,10 +33,10 @@ export default function reducer(state = defaultState, action) {
}
}
-export function setActiveMenu(active_menu) {
+export function setActiveMenu(activeMenu) {
return {
type: SET_ACTIVE_MENU,
- active_menu
+ activeMenu
}
}