mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
IC status and graph now load as soon as ICs are loaded #265
This commit is contained in:
parent
b24f5cf638
commit
ba81bf14e6
2 changed files with 21 additions and 20 deletions
|
@ -19,6 +19,7 @@ import ArrayStore from '../common/array-store';
|
|||
import ICsDataManager from './ics-data-manager';
|
||||
import ICDataDataManager from './ic-data-data-manager';
|
||||
import NotificationsDataManager from "../common/data-managers/notifications-data-manager";
|
||||
import AppDispatcher from '../common/app-dispatcher';
|
||||
|
||||
class InfrastructureComponentStore extends ArrayStore {
|
||||
constructor() {
|
||||
|
@ -28,6 +29,26 @@ 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") {
|
||||
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,
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -119,26 +119,6 @@ class InfrastructureComponents extends Component {
|
|||
token: this.state.sessionToken,
|
||||
});
|
||||
|
||||
this.state.ics.forEach(ic => {
|
||||
if (ic.type === "villas-node" || ic.type === "villas-relay") {
|
||||
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,
|
||||
});
|
||||
|
||||
AppDispatcher.dispatch({
|
||||
type: 'ic-graph/get-graph',
|
||||
url: ic.apiurl + "/graph.svg",
|
||||
socketname: splitWebsocketURL[splitWebsocketURL.length - 1],
|
||||
token: this.state.sessionToken,
|
||||
icid: ic.id,
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue