fix devide default name
This commit is contained in:
parent
49ba4283bf
commit
573ffe1661
1 changed files with 9 additions and 9 deletions
|
@ -36,7 +36,7 @@ export default class NewDevice extends Component {
|
||||||
step: 1,
|
step: 1,
|
||||||
openModal: false,
|
openModal: false,
|
||||||
motion: false,
|
motion: false,
|
||||||
name: "",
|
deviceName: "",
|
||||||
};
|
};
|
||||||
this.baseState = this.state;
|
this.baseState = this.state;
|
||||||
this.createDevice = this.createDevice.bind(this);
|
this.createDevice = this.createDevice.bind(this);
|
||||||
|
@ -97,23 +97,23 @@ export default class NewDevice extends Component {
|
||||||
|
|
||||||
switch (this.state.typeOfDevice) {
|
switch (this.state.typeOfDevice) {
|
||||||
case "regularLight":
|
case "regularLight":
|
||||||
if (this.state.name === "") {
|
if (this.state.deviceName === "") {
|
||||||
data.params["name"] = "Regular Light";
|
data.params["name"] = "Regular Light";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "smartPlug":
|
case "smartPlug":
|
||||||
if (this.state.name === "") {
|
if (this.state.deviceName === "") {
|
||||||
data.params["name"] = "Smart Plug";
|
data.params["name"] = "Smart Plug";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "dimmableLight":
|
case "dimmableLight":
|
||||||
if (this.state.name === "") {
|
if (this.state.deviceName === "") {
|
||||||
data.params["name"] = "Dimmable Light";
|
data.params["name"] = "Dimmable Light";
|
||||||
}
|
}
|
||||||
data.params["intensity"] = 0;
|
data.params["intensity"] = 0;
|
||||||
break;
|
break;
|
||||||
case "sensor":
|
case "sensor":
|
||||||
if (this.state.name === "") {
|
if (this.state.deviceName === "") {
|
||||||
data.params["name"] = "Sensor";
|
data.params["name"] = "Sensor";
|
||||||
}
|
}
|
||||||
if (!this.state.motion) {
|
if (!this.state.motion) {
|
||||||
|
@ -122,19 +122,19 @@ export default class NewDevice extends Component {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "switch":
|
case "switch":
|
||||||
if (this.state.name === "") {
|
if (this.state.deviceName === "") {
|
||||||
data.params["name"] = "Switch";
|
data.params["name"] = "Switch";
|
||||||
}
|
}
|
||||||
data.params["lights"] = this.state.lightsAttached;
|
data.params["lights"] = this.state.lightsAttached;
|
||||||
break;
|
break;
|
||||||
case "buttonDimmer":
|
case "buttonDimmer":
|
||||||
if (this.state.name === "") {
|
if (this.state.deviceName === "") {
|
||||||
data.params["name"] = "Button Dimmer";
|
data.params["name"] = "Button Dimmer";
|
||||||
}
|
}
|
||||||
data.params["lights"] = this.state.lightsAttached;
|
data.params["lights"] = this.state.lightsAttached;
|
||||||
break;
|
break;
|
||||||
case "knobDimmer":
|
case "knobDimmer":
|
||||||
if (this.state.name === "") {
|
if (this.state.deviceName === "") {
|
||||||
data.params["name"] = "Knob Dimmer";
|
data.params["name"] = "Knob Dimmer";
|
||||||
}
|
}
|
||||||
data.params["lights"] = this.state.lightsAttached;
|
data.params["lights"] = this.state.lightsAttached;
|
||||||
|
@ -142,7 +142,7 @@ export default class NewDevice extends Component {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
console.log(data);
|
|
||||||
this.props.addDevice(data);
|
this.props.addDevice(data);
|
||||||
this.resetState();
|
this.resetState();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue