[web] fix ducks/flows

This commit is contained in:
Jason 2016-06-23 01:04:04 +08:00
parent 7671224b4c
commit bcea39657a
2 changed files with 18 additions and 9 deletions

View File

@ -8,7 +8,7 @@ export const ADD = 'EVENTLOG_ADD'
export const WS_MSG = 'EVENTLOG_WS_MSG'
export const REQUEST = 'EVENTLOG_REQUEST'
export const RECEIVE = 'EVENTLOG_RECEIVE'
export const ERROR = 'EVENTLOG_ERROR'
export const FETCH_ERROR = 'EVENTLOG_FETCH_ERROR'
const defaultState = {
logId: 0,
@ -60,12 +60,6 @@ export default function reduce(state = defaultState, action) {
list: reduceList(state.list, listActions.receive(action.list))
}
case FETCH_ERROR:
return {
...state,
list: reduceList(state.list, listActions.fetchError(action.error))
}
default:
return state
}

View File

@ -2,12 +2,15 @@ import { fetchApi as fetch } from '../utils'
import { CMD_RESET as WS_CMD_RESET } from './websocket'
import reduceList, * as listActions from './utils/list'
export const WS_MSG = 'FLOWS_WS_MSG'
export const UPDATE_FILTER = 'FLOWS_UPDATE_FLOW_FILTER'
export const UPDATE_HIGHLIGHT = 'FLOWS_UPDATE_FLOW_HIGHLIGHT'
export const UPDATE_SORT = 'FLOWS_UPDATE_FLOW_SORT'
export const WS_MSG = 'FLOWS_WS_MSG'
export const SELECT = 'FLOWS_SELECT'
export const REQUEST_ACTION = 'FLOWS_REQUEST_ACTION'
export const REQUEST = 'FLOWS_REQUEST'
export const RECEIVE = 'FLOWS_RECEIVE'
export const FETCH_ERROR = 'FLOWS_FETCH_ERROR'
const defaultState = {
selected: [],
@ -52,6 +55,18 @@ export default function reduce(state = defaultState, action) {
list: reduceList(state.list, listActions.handleWsMsg(action.msg)),
}
case REQUEST:
return {
...state,
list: reduceList(state.list, listActions.request())
}
case RECEIVE:
return {
...state,
list: reduceList(state.list, listActions.receive(action.list))
}
default:
return state
}
@ -93,7 +108,7 @@ export function updateHighlight(highlight) {
* @public
*/
export function updateSorter(column, desc, sortKeyFun) {
return { type: SET_SORTER, column, desc, sortKeyFun }
return { type: UPDATE_SORTER, column, desc, sortKeyFun }
}
/**