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

request VILLASnode status only if APIurl exists; make API url editable

This commit is contained in:
Sonja Happ 2021-01-25 12:33:37 +01:00
parent 011159b1cc
commit 5903bcc832
3 changed files with 13 additions and 12 deletions

View file

@ -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 {
</FormGroup>
<FormGroup controlId="websocketurl">
<FormLabel column={false}>Websocket URL</FormLabel>
<FormControl type="text" placeholder={this.props.ic.websocketurl} value={this.state.websocketurl || 'http://' } onChange={(e) => this.handleChange(e)} />
<FormControl type="text" placeholder={this.props.ic.websocketurl} value={this.state.websocketurl} onChange={(e) => this.handleChange(e)} />
<FormControl.Feedback />
</FormGroup>
<FormGroup controlId="apiurl">
<FormLabel column={false}>API URL</FormLabel>
<FormControl type="text" placeholder={this.props.ic.apiurl} value={this.state.apiurl || 'http://' } onChange={(e) => this.handleChange(e)} />
<FormControl type="text" placeholder={this.props.ic.apiurl} value={this.state.apiurl} onChange={(e) => this.handleChange(e)} />
<FormControl.Feedback />
</FormGroup>
<FormGroup controlId="location">

View file

@ -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,

View file

@ -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',