ecodash/templates/default/admin.html
MassiveBox 6dc8fa3750 Move towards selectable time ranges in the dashboard
- Add the installation date to frontend and backend
- Add an error page to help with the upgrade from the previous version
- Avoid querying history if installation date is not set
- Make the fillMissing function work for periods of different lenght than than 8 days
2022-12-04 12:50:11 +01:00

55 lines
2.2 KiB
HTML

<h1>Admin Panel</h1>
<p>Here you can edit all the configurations for EcoDash.</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>