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

Fixes in IC data store for status queries of VILLASnode and VILLASrelay #303 #304

- query config and statistics only for type villas-node
- query status only for category gateway
- update UUID of IC based on raw status
This commit is contained in:
Sonja Happ 2021-05-07 10:09:43 +02:00
parent 1cd7afbad0
commit 16c0dd1760
3 changed files with 11 additions and 4 deletions

View file

@ -118,13 +118,17 @@ class InfrastructureComponentStore extends ArrayStore {
tempIC.state = action.data.state;
tempIC.uptime = action.data.time_now - action.data.time_started;
tempIC.statusupdateraw = action.data
tempIC.uuid = action.data.uuid
AppDispatcher.dispatch({
type: 'ics/start-edit',
data: tempIC,
token: action.token,
});
ICsDataManager.getConfig(action.url, action.token, tempIC);
if(tempIC.type === "villas-node"){
ICsDataManager.getConfig(action.url, action.token, tempIC);
}
}
return super.reduce(state, action);
@ -148,7 +152,10 @@ class InfrastructureComponentStore extends ArrayStore {
data: temp,
token: action.token,
});
ICsDataManager.getStatistics(action.url, action.token, temp);
if(temp.type === "villas-node") {
ICsDataManager.getStatistics(action.url, action.token, temp);
}
}
return super.reduce(state, action);

View file

@ -63,7 +63,7 @@ class InfrastructureComponent extends React.Component {
refresh() {
// get status of VILLASnode and VILLASrelay ICs
if ((this.state.ic.type === "villas-node" || this.state.ic.type === "villas-relay")
if (this.state.ic.category === "gateway" && (this.state.ic.type === "villas-node" || this.state.ic.type === "villas-relay")
&& this.state.ic.apiurl !== '' && this.state.ic.apiurl !== undefined && this.state.ic.apiurl !== null && !this.state.ic.managedexternally) {
AppDispatcher.dispatch({
type: 'ics/get-status',

View file

@ -137,7 +137,7 @@ class InfrastructureComponents extends Component {
// get status of VILLASnode and VILLASrelay ICs
this.state.ics.forEach(ic => {
if ((ic.type === "villas-node" || ic.type === "villas-relay")
if (ic.category === "gateway" && (ic.type === "villas-node" || ic.type === "villas-relay")
&& ic.apiurl !== '' && ic.apiurl !== undefined && ic.apiurl !== null && !ic.managedexternally) {
AppDispatcher.dispatch({
type: 'ics/get-status',