ecodash/templates/default/admin.html
2023-03-04 23:21:31 +01:00

58 lines
2.3 KiB
HTML

<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>
{{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>
<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>
<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>