Add date to html output.
This commit is contained in:
@@ -41,6 +41,9 @@ var htmlTemplate string = `<html>
|
||||
|
||||
<body>
|
||||
{{if .Error}} <p>Error encountered: {{.Error}} </p> {{end}}
|
||||
<dl>
|
||||
<dt> Date: {{.Date}}</dt>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt> LEDs:</dt>
|
||||
{{range .Leds}}
|
||||
|
||||
@@ -36,6 +36,7 @@ import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -94,6 +95,8 @@ func NewWebGui(source datasource.DataPoller, batteryCapacity float64) *WebGui {
|
||||
type TemplateInput struct {
|
||||
Error error
|
||||
|
||||
Date string
|
||||
|
||||
OutCurrent string
|
||||
OutVoltage string
|
||||
OutPower string
|
||||
@@ -132,6 +135,7 @@ func buildTemplateInput(statusErr *statusProcessed) *TemplateInput {
|
||||
|
||||
tmpInput := &TemplateInput{
|
||||
Error: statusErr.err,
|
||||
Date: time.Now().Format(time.RFC1123Z),
|
||||
OutCurrent: fmt.Sprintf("%.3f", status.OutCurrent),
|
||||
OutVoltage: fmt.Sprintf("%.3f", status.OutVoltage),
|
||||
OutPower: fmt.Sprintf("%.3f", outPower),
|
||||
|
||||
Reference in New Issue
Block a user