From 8da623c60389bffc76dd3c1b6d8055dd19f97607 Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 25 Jun 2016 00:53:56 +0800 Subject: [PATCH] [web] fix selectFlows --- web/src/js/components/Header/FlowMenu.jsx | 2 +- web/src/js/components/MainView.jsx | 4 ++-- web/src/js/ducks/settings.js | 6 +++--- web/src/js/ducks/views/main.js | 4 +++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/web/src/js/components/Header/FlowMenu.jsx b/web/src/js/components/Header/FlowMenu.jsx index 689cea5c1..1fa7037f7 100644 --- a/web/src/js/components/Header/FlowMenu.jsx +++ b/web/src/js/components/Header/FlowMenu.jsx @@ -29,6 +29,6 @@ function FlowMenu({ flow }) { export default connect( state => ({ - flow: state.flows.list.data[state.flows.views.main.selected[0]], + flow: state.flows.list.byId[state.flows.views.main.selected[0]], }) )(FlowMenu) diff --git a/web/src/js/components/MainView.jsx b/web/src/js/components/MainView.jsx index b3fe73ec9..847223d26 100644 --- a/web/src/js/components/MainView.jsx +++ b/web/src/js/components/MainView.jsx @@ -6,7 +6,7 @@ import { Key } from '../utils.js' import Splitter from './common/Splitter' import FlowTable from './FlowTable' import FlowView from './FlowView' -import { selectFlow, updateFilter, updateHighlight } from '../ducks/views/main' +import { select as selectFlow, updateFilter, updateHighlight } from '../ducks/views/main' class MainView extends Component { @@ -185,7 +185,7 @@ export default connect( flows: state.flows.views.main.view.data, filter: state.flows.views.main.filter, highlight: state.flows.views.main.highlight, - selectedFlow: state.flows.list.data[state.flows.views.main.selected[0]] + selectedFlow: state.flows.list.byId[state.flows.views.main.selected[0]] }), { selectFlow, diff --git a/web/src/js/ducks/settings.js b/web/src/js/ducks/settings.js index c5f0a90bd..7101aa1e5 100644 --- a/web/src/js/ducks/settings.js +++ b/web/src/js/ducks/settings.js @@ -4,10 +4,10 @@ import * as msgQueueActions from './msgQueue' export const MSG_TYPE = 'UPDATE_SETTINGS' export const DATA_URL = '/settings' -export const RECEIVE = 'RECEIVE' -export const UPDATE = 'UPDATE' +export const RECEIVE = 'RECEIVE' +export const UPDATE = 'UPDATE' export const REQUEST_UPDATE = 'REQUEST_UPDATE' -export const UNKNOWN_CMD = 'SETTINGS_UNKNOWN_CMD' +export const UNKNOWN_CMD = 'SETTINGS_UNKNOWN_CMD' const defaultState = { settings: {}, diff --git a/web/src/js/ducks/views/main.js b/web/src/js/ducks/views/main.js index 74dc2606a..264c0c4c4 100755 --- a/web/src/js/ducks/views/main.js +++ b/web/src/js/ducks/views/main.js @@ -164,7 +164,9 @@ export function updateSorter(column, desc) { * @public */ export function select(id) { - return { type: SELECT, currentSelection: getState().flows.views.main.selected[0], id } + return (dispatch, getState) => { + dispatch({ type: SELECT, currentSelection: getState().flows.views.main.selected[0], id }) + } } /**