ecodash/templates/default/admin.html

58 lines
2.3 KiB
HTML
Raw Normal View History

2022-10-15 19:58:44 +02:00
<h1>Admin Panel</h1>
<p>
Here you can edit all the configurations for EcoDash.<br>
<a href="https://ecodash.xyz/docs/setup/admin-panel">Documentation</a>
</p>
2022-10-15 19:58:44 +02:00
{{if .Warning}}
<article class="card" style="background-color: {{if .Warning.IsSuccess}}#008000{{else}}#ff5050{{end}}; color: white">
<header>
<h3>{{.Warning.Header}}</h3>
</header>
<footer>
<p>{{.Warning.BodyHTML}}</p>
</footer>
</article>
{{end}}
<form action="./admin" method="POST">
<h3>HomeAssistant</h3>
<label>HomeAssistant's base URL <input type="text" name="base_url" value="{{.Config.HomeAssistant.BaseURL}}" required></label>
2023-05-01 22:07:50 +02:00
<label>HomeAssistant's API Key <input type="text" name="api_key" value="{{.Config.HomeAssistant.APIKey}}" required></label>
<lablel>Installation date<input type="date" name="installation_date" value="{{HTMLDateFormat .Config.HomeAssistant.InstallationDate}}" required></lablel>
2022-10-15 19:58:44 +02:00
<h3>Sensors</h3>
<label>Polled Smart Energy Summation entity ID <input type="text" name="polled_smart_energy_summation" value="{{.Config.Sensors.PolledSmartEnergySummation}}" required></label>
<label>CO2 signal Grid fossil fuel percentage entity ID <input type="text" name="fossil_percentage" value="{{.Config.Sensors.FossilPercentage}}" required></label>
<h3>Admin account</h3>
<label>Username <input type="text" name="username" value="{{.Config.Administrator.Username}}" required></label>
{{if .Config.Administrator.PasswordHash}}
<label>
<input type="checkbox" name="keep_old_password" onchange="toggle_password_edit()">
<p class="checkable">Keep the old password</p>
</label>
{{end}}
<label>Password <input type="password" name="password" id="password" required></label>
<h3>Personalization</h3>
<label>Theme
<select name="theme">
{{range .Themes}}
<option value="{{.Name}}">{{.Name}}</option>
{{end}}
</select>
</label>
<label>Dashboard name <input type="text" name="name" value="{{.Config.Dashboard.Name}}"></label>
<input type="submit" placeholder="Submit" style="margin-top: 2em; width: 100%">
</form>
<script>
function toggle_password_edit() {
const psw_field = document.getElementById('password');
psw_field.disabled = !psw_field.disabled;
}
</script>