fix dropdown css, add new selection after delete

This commit is contained in:
Clemens 2016-08-22 08:57:55 +02:00
parent d0b420f383
commit eddc424379
2 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,4 @@
hr .divider {
hr.divider {
margin-top: 5px;
margin-bottom: 5px;
}

View File

@ -1,5 +1,6 @@
import { fetchApi } from '../utils'
import reduceList, * as listActions from './utils/list'
import { selectRelative } from './flowView'
import * as msgQueueActions from './msgQueue'
import * as websocketActions from './websocket'
@ -210,8 +211,14 @@ export function updateFlow(item) {
* @private
*/
export function removeFlow(id) {
return (dispatch) => {
dispatch(select())
return (dispatch, getState) => {
let currentIndex = getState().flowView.indexOf[getState().flows.selected[0]]
let maxIndex = getState().flowView.data.length - 1
let deleteLastEntry = maxIndex == 0
if (deleteLastEntry)
dispatch(select())
else
dispatch(selectRelative(currentIndex == maxIndex ? -1 : 1) )
dispatch({ type: REMOVE, id })
}
}