Merge branch '51-added-update-dimmablelight' into 'dev'
added update for dimmableLights Closes #51 See merge request sa4-2020/the-sanmarinoes/frontend!50
This commit is contained in:
commit
8b49bdfbb7
4 changed files with 15 additions and 19 deletions
|
@ -31,7 +31,6 @@ class App extends Component {
|
||||||
let userJsonString = localStorage.getItem("token");
|
let userJsonString = localStorage.getItem("token");
|
||||||
let exp = localStorage.getItem("exp");
|
let exp = localStorage.getItem("exp");
|
||||||
let date = new Date().getTime();
|
let date = new Date().getTime();
|
||||||
console.log(exp > date, date)
|
|
||||||
if (userJsonString && exp && date < exp) {
|
if (userJsonString && exp && date < exp) {
|
||||||
loggedIn = true;
|
loggedIn = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -53,7 +52,6 @@ class App extends Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (window.location) {
|
if (window.location) {
|
||||||
const values = queryString.parse(window.location.search);
|
const values = queryString.parse(window.location.search);
|
||||||
console.log(values);
|
|
||||||
this.setState({
|
this.setState({
|
||||||
query : values
|
query : values
|
||||||
});
|
});
|
||||||
|
|
|
@ -36,7 +36,6 @@ export default class Light extends Component {
|
||||||
|
|
||||||
setIntensity = (newValue) => {
|
setIntensity = (newValue) => {
|
||||||
this.props.device.intensity = Math.round(newValue * 100) <= 1 ? 1 : Math.round(newValue * 100);
|
this.props.device.intensity = Math.round(newValue * 100) <= 1 ? 1 : Math.round(newValue * 100);
|
||||||
console.log(this.props.device.intensity)
|
|
||||||
call.deviceUpdate(this.props.device, 'dimmableLight')
|
call.deviceUpdate(this.props.device, 'dimmableLight')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.status === 200 ) {
|
if (res.status === 200 ) {
|
||||||
|
@ -69,7 +68,7 @@ export default class Light extends Component {
|
||||||
render() {
|
render() {
|
||||||
const intensityLightView = (
|
const intensityLightView = (
|
||||||
<CircularInput
|
<CircularInput
|
||||||
value={Math.round(this.props.device.intensity/100)}
|
value={+(Math.round(this.props.device.intensity/100 + "e+2") + "e-2")}
|
||||||
onChange={this.setIntensity}
|
onChange={this.setIntensity}
|
||||||
style={style}
|
style={style}
|
||||||
>
|
>
|
||||||
|
|
|
@ -108,12 +108,12 @@ export default class ModalWindow extends Component {
|
||||||
<p>Insert the name of the room:</p>
|
<p>Insert the name of the room:</p>
|
||||||
<Form.Field>
|
<Form.Field>
|
||||||
<Input label='Room name' placeholder='Room Name' name="name" type='text' onChange={this.changeSomething}
|
<Input label='Room name' placeholder='Room Name' name="name" type='text' onChange={this.changeSomething}
|
||||||
value={this.props.type === "new" && this.props.idRoom !== -1 ? "" : "" }/>
|
value={this.props.type === "new" ? "" : this.props.idRoom.name }/>
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
<p>Insert an image of the room:</p>
|
<p>Insert an image of the room:</p>
|
||||||
<Form.Field>
|
<Form.Field>
|
||||||
<Input label='Room image' type='file' name="img" onChange={this.changeSomething}
|
<Input label='Room image' type='file' name="img" onChange={this.changeSomething}
|
||||||
value={this.props.type === "new" && this.props.idRoom !== -1 ? "" : this.props.idRoom.images }/>
|
value={this.props.type === "new" ? "" : this.props.idRoom.images }/>
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ export default class ModalWindow extends Component {
|
||||||
<Button icon labelPosition='left' inverted color='red' onClick={this.deleteRoom}>
|
<Button icon labelPosition='left' inverted color='red' onClick={this.deleteRoom}>
|
||||||
<Icon name='trash alternate' />
|
<Icon name='trash alternate' />
|
||||||
Delete room
|
Delete room
|
||||||
</Button> : "" }
|
</Button> : null }
|
||||||
|
|
||||||
</Modal.Content>
|
</Modal.Content>
|
||||||
<Modal.Actions>
|
<Modal.Actions>
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Navbar extends Component {
|
||||||
render(){
|
render(){
|
||||||
//const { activeItem } = this.state
|
//const { activeItem } = this.state
|
||||||
return (
|
return (
|
||||||
<div style={{background: '#1b1c1d'}}>
|
<div style={{background: '#1b1c1d!important'}}>
|
||||||
<Segment.Group>
|
<Segment.Group>
|
||||||
<Responsive as={Segment} minWidth={768}>
|
<Responsive as={Segment} minWidth={768}>
|
||||||
<Grid>
|
<Grid>
|
||||||
|
@ -164,21 +164,20 @@ class Navbar extends Component {
|
||||||
</Dropdown.Menu>
|
</Dropdown.Menu>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</Menu >
|
</Menu >
|
||||||
{
|
<Grid inverted>
|
||||||
this.state.activeItem !== -1 ?
|
|
||||||
<Grid>
|
|
||||||
<Grid.Row>
|
<Grid.Row>
|
||||||
<Grid.Column width={8}>
|
<Grid.Column width={8}>
|
||||||
<ModalWindow type="new" idRoom={this.state.activeRoom} updateRoom={this.props.updateRoom} deleteRoom={this.props.deleteRoom}/>
|
<ModalWindow type="new" addRoom={this.props.addRoom} />
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
|
{
|
||||||
|
this.state.activeItem !== -1 ?
|
||||||
<Grid.Column width={8}>
|
<Grid.Column width={8}>
|
||||||
<ModalWindow type="modify" idRoom={this.state.activeRoom} updateRoom={this.props.updateRoom} deleteRoom={this.props.deleteRoom}/>
|
<ModalWindow type="modify" idRoom={this.state.activeRoom} updateRoom={this.props.updateRoom} deleteRoom={this.props.deleteRoom}/>
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
|
: null
|
||||||
|
}
|
||||||
</Grid.Row>
|
</Grid.Row>
|
||||||
</Grid>
|
</Grid>
|
||||||
:
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</Responsive>
|
</Responsive>
|
||||||
|
|
||||||
</Segment.Group>
|
</Segment.Group>
|
||||||
|
|
Loading…
Reference in a new issue