Handle loading message for empty topos correctly.

It was showing infinite loading...
This commit is contained in:
Simon Howe
2016-05-12 13:00:38 +02:00
parent 5df5e402f3
commit 04f4071fd3
3 changed files with 7 additions and 12 deletions

View File

@@ -468,6 +468,8 @@ export function receiveNodeDetails(details) {
export function receiveNodesDelta(delta) {
return (dispatch, getState) => {
dispatch({ type: ActionTypes.SET_RECEIVED_NODES_DELTA });
if (delta.add || delta.update || delta.remove) {
const state = getState();
if (state.get('updatePausedAt') !== null) {

View File

@@ -54,6 +54,7 @@ const ACTION_TYPES = [
'PIN_NETWORK',
'UNPIN_NETWORK',
'SHOW_NETWORKS',
'SET_RECEIVED_NODES_DELTA',
];
export default _.zipObject(ACTION_TYPES, ACTION_TYPES);

View File

@@ -10,7 +10,6 @@ import { getNetworkNodes, getAvailableNetworks } from '../utils/network-view-uti
import { findTopologyById, getAdjacentNodes, setTopologyUrlsById,
updateTopologyIds, filterHiddenTopologies } from '../utils/topology-utils';
const log = debug('scope:app-store');
const error = debug('scope:error');
// Helpers
@@ -481,18 +480,11 @@ export function rootReducer(state = initialState, action) {
return state;
}
case ActionTypes.SET_RECEIVED_NODES_DELTA: {
return state.set('nodesLoaded', true);
}
case ActionTypes.RECEIVE_NODES_DELTA: {
const emptyMessage = !action.delta.add && !action.delta.remove
&& !action.delta.update;
state = state.set('nodesLoaded', true);
if (!emptyMessage) {
log('RECEIVE_NODES_DELTA',
'remove', _.size(action.delta.remove),
'update', _.size(action.delta.update),
'add', _.size(action.delta.add));
}
state = state.set('errorUrl', null);
// nodes that no longer exist