added pages

This commit is contained in:
Paolo Asperti 2020-12-28 22:58:08 +01:00
parent 28dcadbeef
commit 97fed358c6
Signed by: paspo
GPG Key ID: 06D46905D19D5182
10 changed files with 227 additions and 47 deletions

7
src/backup_ui.go Normal file
View File

@ -0,0 +1,7 @@
package main
import "gopkg.in/macaron.v1"
func backupPage(ctx *macaron.Context) {
ctx.HTML(200, "backup")
}

7
src/lan_ui.go Normal file
View File

@ -0,0 +1,7 @@
package main
import "gopkg.in/macaron.v1"
func lanPage(ctx *macaron.Context) {
ctx.HTML(200, "lan")
}

7
src/syslog_ui.go Normal file
View File

@ -0,0 +1,7 @@
package main
import "gopkg.in/macaron.v1"
func syslogPage(ctx *macaron.Context) {
ctx.HTML(200, "syslog")
}

View File

@ -22,6 +22,9 @@ func upsPage(ctx *macaron.Context) {
ctx.Data["upsmfr"] = upsVars["device.mfr"].Value
ctx.Data["upsmodel"] = upsVars["device.model"].Value
ctx.Data["upsserial"] = upsVars["device.serial"].Value
ctx.Data["upsload"] = upsVars["ups.load"].Value
ctx.Data["upscharge"] = upsVars["battery.charge"].Value
// }
ctx.HTML(200, "ups")

View File

@ -105,10 +105,13 @@ func startServer() {
// m.Get("/", myHandler)
m.Get("/", statusPage)
m.Get("/lan", lanPage)
m.Get("/mqtt", mqttPage)
m.Post("/mqtt", binding.Bind(MQTTPostForm{}), mqttPost)
m.Get("/ups", upsPage)
m.Post("/ups", binding.Bind(UPSPostForm{}), upsPost)
m.Get("/syslog", syslogPage)
m.Get("/backup", backupPage)
m.Get("/json/status", jsonStatus)
m.Post("/json/outlet/:id/toggle", jsonOutletToggle)

49
templates/backup.html Normal file
View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
{% include "common/common-head.html" %}
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
{% include "common/page-header.html" %} {% with pageselected="backup" %} {% include "common/sidebar-menu.html" %} {% endwith %}
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Backup / Restore configuration</h3>
</div>
<!-- /.box-header -->
</div>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
{% include "common/footer.html" %}
</div>
<!-- ./wrapper -->
{% include "common/common-js.html" %}
</body>
</html>

View File

@ -6,61 +6,53 @@
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu" data-widget="tree">
{% if pageselected == "status" %}
<li class="active">
{% else %}
<li>
{% endif %}
<a href="/">
<i class="fa fa-dashboard"></i> <span>Status</span>
</a>
</li>
<li {% if pageselected=="status" %} class="active" {% endif %}>
<a href="/">
<i class="fa fa-dashboard"></i> <span>Status</span>
</a>
</li>
{% if pageselected == "boards" %}
<li class="active">
{% else %}
<li>
{% endif %}
<a href="/boards">
<i class="fa fa-sliders"></i> <span>Boards</span>
</a>
</li>
<li {% if pageselected=="boards" %} class="active" {% endif %}>
<a href="/boards">
<i class="fa fa-sliders"></i> <span>Boards</span>
</a>
</li>
{% if pageselected in "lan mqtt ups syslog backup restore" %}
<li class="treeview active menu-open">
{% else %}
<li class="treeview">
{% endif %}
<a href="#">
<i class="fa fa-gears"></i> <span>Settings</span>
<span class="pull-right-container">
<li class="treeview {% if pageselected in " lan mqtt ups syslog backup " %}active menu-open{% endif %}">
<a href="#">
<i class="fa fa-gears"></i>
<span>Settings</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
</a>
<ul class="treeview-menu">
<li><a href="/lan"><i class="fa fa-circle-o"></i> LAN</a></li>
<ul class="treeview-menu">
<li {% if pageselected=="lan" %}class="active" {% endif %}>
<a href="/lan"><i class="fa fa-circle-o"></i> LAN</a>
</li>
{% if pageselected == "mqtt" %}
<li class="active">
{% else %}
<li>
{% endif %}
<a href="/mqtt"><i class="fa fa-circle-o"></i> MQTT</a></li>
<li {% if pageselected=="mqtt" %}class="active" {% endif %}>
<a href="/mqtt"><i class="fa fa-circle-o"></i> MQTT</a>
</li>
{% if pageselected == "ups" %}
<li class="active">
{% else %}
<li>
{% endif %}
<a href="/ups"><i class="fa fa-circle-o"></i> UPS</a></li>
<li><a href="/syslog"><i class="fa fa-circle-o"></i> syslog</a></li>
<li><a href="/backup"><i class="fa fa-circle-o"></i> backup</a></li>
<li><a href="/restore"><i class="fa fa-circle-o"></i> restore</a></li>
</ul>
</li>
<li {% if pageselected=="ups" %}class="active" {% endif %}>
<a href="/ups"><i class="fa fa-circle-o"></i> UPS</a>
</li>
<li {% if pageselected=="syslog" %}class="active" {% endif %}>
<a href="/syslog"><i class="fa fa-circle-o"></i> Syslog</a>
</li>
<li {% if pageselected=="backup" %}class="active" {% endif %}>
<a href="/backup"><i class="fa fa-circle-o"></i> Backup/Restore</a>
</li>
</ul>
</li>
</ul>
</section>
<!-- /.sidebar -->
</aside>
</aside>

49
templates/lan.html Normal file
View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
{% include "common/common-head.html" %}
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
{% include "common/page-header.html" %} {% with pageselected="lan" %} {% include "common/sidebar-menu.html" %} {% endwith %}
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">LAN configuration</h3>
</div>
<!-- /.box-header -->
</div>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
{% include "common/footer.html" %}
</div>
<!-- ./wrapper -->
{% include "common/common-js.html" %}
</body>
</html>

49
templates/syslog.html Normal file
View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
{% include "common/common-head.html" %}
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
{% include "common/page-header.html" %} {% with pageselected="syslog" %} {% include "common/sidebar-menu.html" %} {% endwith %}
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Syslog configuration</h3>
</div>
<!-- /.box-header -->
</div>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
{% include "common/footer.html" %}
</div>
<!-- ./wrapper -->
{% include "common/common-js.html" %}
</body>
</html>

View File

@ -63,6 +63,20 @@
</div>
</div>
<div class="form-group">
<label for="upsload" class="col-sm-2 control-label">UPS Load</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="upsload" disabled="" value="{{ upsload }} %">
</div>
</div>
<div class="form-group">
<label for="upscharge" class="col-sm-2 control-label">UPS Charge</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="upscharge" disabled="" value="{{ upscharge }} %">
</div>
</div>
<div class="form-group">
<label for="host" class="col-sm-2 control-label">Host</label>
<div class="col-sm-10">