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

edit state of IC according to received state #265

This commit is contained in:
Laura Fuentes Grau 2021-01-17 18:47:08 +01:00
parent 3e74e08861
commit 8edeb4b04c
3 changed files with 13 additions and 2 deletions

View file

@ -44,15 +44,25 @@ class IcDataDataManager {
}
}
getStatus(url,socketname,token,icid){
getStatus(url,socketname,token,icid,ic){
RestAPI.get(url, null).then(response => {
let tempIC = ic;
tempIC.state = response.state;
AppDispatcher.dispatch({
type: 'ic-status/status-received',
data: response,
token: token,
socketname: socketname,
icid: icid,
ic: ic
});
if(!ic.managedexternally){
AppDispatcher.dispatch({
type: 'ics/start-edit',
data: tempIC,
token: token,
});
}
}).catch(error => {
AppDispatcher.dispatch({
type: 'ic-status/status-error',

View file

@ -28,7 +28,7 @@ class ICStatusStore extends ArrayStore {
switch(action.type) {
case 'ic-status/get-status':
ICDataDataManager.getStatus(action.url, action.socketname, action.token, action.icid);
ICDataDataManager.getStatus(action.url, action.socketname, action.token, action.icid, action.ic);
return super.reduce(state, action);
case 'ic-status/status-received':

View file

@ -38,6 +38,7 @@ class InfrastructureComponentStore extends ArrayStore {
socketname: splitWebsocketURL[splitWebsocketURL.length - 1],
token: action.token,
icid: ic.id,
ic: ic
});
AppDispatcher.dispatch({