1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

perform VILLASnode status and graph query in refresh method for ICs

This commit is contained in:
Sonja Happ 2021-01-25 12:44:26 +01:00
parent 5903bcc832
commit 88bc504d0d
2 changed files with 24 additions and 22 deletions

View file

@ -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);

View file

@ -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,
});
}
})
}
}