diff --git a/src/ic/ic-store.js b/src/ic/ic-store.js index 5a77642..21d84ea 100644 --- a/src/ic/ic-store.js +++ b/src/ic/ic-store.js @@ -30,28 +30,6 @@ class InfrastructureComponentStore extends ArrayStore { reduce(state, action) { switch(action.type) { case 'ics/loaded': - action.data.forEach(ic => { - if ((ic.type === "villas-node" || ic.type === "villas-relay") - && ic.apiurl !== '' && ic.apiurl !== undefined && ic.apiurl !== null) { - let splitWebsocketURL = ic.websocketurl.split("/"); - AppDispatcher.dispatch({ - type: 'ic-status/get-status', - url: ic.apiurl + "/status", - socketname: splitWebsocketURL[splitWebsocketURL.length - 1], - token: action.token, - icid: ic.id, - ic: ic - }); - - AppDispatcher.dispatch({ - type: 'ic-graph/get-graph', - url: ic.apiurl + "/graph.svg", - socketname: splitWebsocketURL[splitWebsocketURL.length - 1], - token: action.token, - icid: ic.id, - }); - } - }) return super.reduce(state, action); diff --git a/src/ic/ics.js b/src/ic/ics.js index 9868231..5c8c6fb 100644 --- a/src/ic/ics.js +++ b/src/ic/ics.js @@ -119,6 +119,30 @@ class InfrastructureComponents extends Component { token: this.state.sessionToken, }); + // get status and graph of VILLASnode and VILLASrelay ICs + this.state.ics.forEach(ic => { + if ((ic.type === "villas-node" || ic.type === "villas-relay") + && ic.apiurl !== '' && ic.apiurl !== undefined && ic.apiurl !== null) { + let splitWebsocketURL = ic.websocketurl.split("/"); + AppDispatcher.dispatch({ + type: 'ic-status/get-status', + url: ic.apiurl + "/status", + socketname: splitWebsocketURL[splitWebsocketURL.length - 1], + token: this.state.sessionToken, + icid: ic.id, + ic: ic + }); + + AppDispatcher.dispatch({ + type: 'ic-graph/get-graph', + url: ic.apiurl + "/graph.svg", + socketname: splitWebsocketURL[splitWebsocketURL.length - 1], + token: this.state.sessionToken, + icid: ic.id, + }); + } + }) + } }