-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
custom_components/shelly/frontend/src/components/YamlInfo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { Component } from 'react'; | ||
import { Instance } from '../data'; | ||
import { SendWebSocketAction } from "../util"; | ||
|
||
interface Props { | ||
instance: Instance | ||
} | ||
|
||
export default class YamlInfo extends Component<Props> { | ||
constructor(props) { | ||
super(props); | ||
this.convert_config = this.convert_config.bind(this); | ||
} | ||
public convert_config(e) { | ||
const { instance } = this.props; | ||
SendWebSocketAction(instance.hass, "s4h/convert", | ||
{ | ||
instanceid : instance.instance_id | ||
}); | ||
} | ||
render() { | ||
const { instance } = this.props; | ||
const show = instance.yaml; | ||
if (!show) | ||
return null; | ||
return <div className="info"> | ||
<p> | ||
Your settings for ShellyForHass is stored in config.yaml and can't be changed here. | ||
</p> | ||
<p> | ||
You can convert this instance to an integration stored in the database. | ||
If you do this you can change the settings here and settings in config.yaml will be ignored and you can remove them. | ||
</p> | ||
<button value="Convert" onClick={this.convert_config}>Convert</button> | ||
</div> | ||
} | ||
} |