From f633c6edb1255f76b416bca1cb0909a4fba93790 Mon Sep 17 00:00:00 2001 From: Filip Barl Date: Fri, 24 Mar 2017 18:45:58 +0100 Subject: [PATCH] Fetch the resource view topologies on first topologies load --- client/app/scripts/actions/app-actions.js | 6 +++++- client/app/scripts/utils/web-api-utils.js | 7 ++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/client/app/scripts/actions/app-actions.js b/client/app/scripts/actions/app-actions.js index fd33701fb..badb484d1 100644 --- a/client/app/scripts/actions/app-actions.js +++ b/client/app/scripts/actions/app-actions.js @@ -618,10 +618,14 @@ export function receiveTopologies(topologies) { state.get('nodeDetails'), dispatch ); - // populate search matches on first load + // Populate search matches on first load if (firstLoad && state.get('searchQuery')) { dispatch(focusSearch()); } + // Fetch all the relevant nodes once on first load + if (firstLoad && isResourceViewModeSelector(state)) { + getResourceViewNodesSnapshot(getState, dispatch); + } }; } diff --git a/client/app/scripts/utils/web-api-utils.js b/client/app/scripts/utils/web-api-utils.js index 0e24baa21..e36464cd2 100644 --- a/client/app/scripts/utils/web-api-utils.js +++ b/client/app/scripts/utils/web-api-utils.js @@ -188,14 +188,11 @@ export function getAllNodes(getState, dispatch) { /** * One-time update of all the nodes of topologies that appear in the current resource view. + * TODO: Replace the one-time snapshot with periodic polling. */ export function getResourceViewNodesSnapshot(getState, dispatch) { const topologyIds = layersTopologyIdsSelector(getState()); - // TODO: Remove the timeout and replace it with normal polling once we figure how to make - // resource view dynamic (from the UI point of view, the challenge is to make it stable). - setTimeout(() => { - getNodesForTopologies(getState, dispatch, topologyIds); - }, 1200); + getNodesForTopologies(getState, dispatch, topologyIds); } export function getTopologies(options, dispatch, initialPoll) {