From 5903bcc83256c8fc9783881722a313dae242da44 Mon Sep 17 00:00:00 2001 From: Sonja Happ Date: Mon, 25 Jan 2021 12:33:37 +0100 Subject: [PATCH] request VILLASnode status only if APIurl exists; make API url editable --- src/ic/edit-ic.js | 16 ++++++++-------- src/ic/ic-data-data-manager.js | 6 +++--- src/ic/ic-store.js | 3 ++- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/ic/edit-ic.js b/src/ic/edit-ic.js index 7ce6d5d..0c8403e 100644 --- a/src/ic/edit-ic.js +++ b/src/ic/edit-ic.js @@ -50,13 +50,13 @@ class EditICDialog extends React.Component { data.name = this.state.name; } - if (this.state.websocketurl != null && this.state.websocketurl !== "" && this.state.websocketurl !== "http://" && this.state.websocketurl !== this.props.ic.websocketurl) { - data.websocketurl = this.state.websocketurl; - } - if (this.state.apiurl != null && this.state.apiurl !== "" && this.state.apiurl !== "http://" && this.state.apiurl !== this.props.ic.apiurl) { - data.apiurl = this.state.apiurl; - } + data.websocketurl = this.state.websocketurl; + + + + data.apiurl = this.state.apiurl; + if (this.state.location != null && this.state.location !== this.props.ic.location) { data.location = this.state.location; @@ -175,12 +175,12 @@ class EditICDialog extends React.Component { Websocket URL - this.handleChange(e)} /> + this.handleChange(e)} /> API URL - this.handleChange(e)} /> + this.handleChange(e)} /> diff --git a/src/ic/ic-data-data-manager.js b/src/ic/ic-data-data-manager.js index 087b294..6bfb421 100644 --- a/src/ic/ic-data-data-manager.js +++ b/src/ic/ic-data-data-manager.js @@ -46,8 +46,6 @@ class IcDataDataManager { 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, @@ -56,7 +54,9 @@ class IcDataDataManager { icid: icid, ic: ic }); - if(!ic.managedexternally){ + if(!ic.managedexternally){ + let tempIC = ic; + tempIC.state = response.state; AppDispatcher.dispatch({ type: 'ics/start-edit', data: tempIC, diff --git a/src/ic/ic-store.js b/src/ic/ic-store.js index 7210477..5a77642 100644 --- a/src/ic/ic-store.js +++ b/src/ic/ic-store.js @@ -31,7 +31,8 @@ class InfrastructureComponentStore extends ArrayStore { switch(action.type) { case 'ics/loaded': action.data.forEach(ic => { - if (ic.type === "villas-node" || ic.type === "villas-relay") { + 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',