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

WIP: IC dialog customization for VILLASnode #303

This commit is contained in:
Laura Fuentes Grau 2021-04-21 21:20:22 +02:00
parent a1807f5834
commit fb6f4f2b97
2 changed files with 53 additions and 3 deletions

View file

@ -112,9 +112,18 @@ class InfrastructureComponentStore extends ArrayStore {
ICsDataManager.getStatus(action.url, action.token, action.ic);
return super.reduce(state, action);
case 'ics/get-config':
ICsDataManager.getConfig(action.url, action.token, action.ic);
return super.reduce(state, action);
case 'ics/get-statistics':
ICsDataManager.getStatistics(action.url, action.token, action.ic);
return super.reduce(state, action);
case 'ics/status-received':
let tempIC = action.ic;
if(!tempIC.managedexternally){
if (!tempIC.managedexternally) {
tempIC.state = action.data.state;
tempIC.uptime = action.data.time_now - action.data.time_started;
tempIC.statusupdateraw = action.data
@ -130,9 +139,17 @@ class InfrastructureComponentStore extends ArrayStore {
console.log("status error:", action.error);
return super.reduce(state, action);
case 'ics/config-error':
console.log("config error:", action.error);
return super.reduce(state, action);
case 'ics/statistics-error':
console.log("statistics error:", action.error);
return super.reduce(state, action);
case 'ics/nodestats-received':
let tempIC2 = action.ic;
if(!tempIC2.managedexternally){
if (!tempIC2.managedexternally) {
if (tempIC2.statusupdateraw === null || tempIC2.statusupdateraw === undefined) {
tempIC2.statusupdateraw = {};
}

View file

@ -117,7 +117,8 @@ class IcsDataManager extends RestDataManager {
})
// get name of websocket
/*let ws_api = ic.websocketurl.split("/")
/*
let ws_api = ic.websocketurl.split("/")
let ws_name = ws_api[ws_api.length-1] // websocket name is the last element in the websocket url
RestAPI.get(url + "/node/" + ws_name + "/stats", null).then(response => {
@ -136,6 +137,38 @@ class IcsDataManager extends RestDataManager {
}
getConfig(url,token,ic){
RestAPI.get(url + "node/" + ic.uuid, null).then(response => {
AppDispatcher.dispatch({
type: 'ics/config-received',
data: response,
token: token,
ic: ic
});
}).catch(error => {
AppDispatcher.dispatch({
type: 'ics/config-error',
error: error
})
})
}
getStatistics(url,token,ic){
RestAPI.get(url + "/node/" +ic.uuid + "/stats", null).then(response => {
AppDispatcher.dispatch({
type: 'ics/statistics-received',
data: response,
token: token,
ic: ic
});
}).catch(error => {
AppDispatcher.dispatch({
type: 'ics/statistics-error',
error: error
})
})
}
restart(url,token){
RestAPI.post(url, null).then(response => {
AppDispatcher.dispatch({