show time in response html
This commit is contained in:
parent
5e67caf0d0
commit
19002030c0
BIN
APIServer.exe
BIN
APIServer.exe
Binary file not shown.
20
ews/ews.go
20
ews/ews.go
@ -5,6 +5,7 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"time"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
)
|
)
|
||||||
@ -610,21 +611,23 @@ func (e *EWS) GetOfflineReport(cfg cnf.Cfg, logger *log.Logger, host string, add
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *EWS) SimpleMsgHTML(clr, msg string) string {
|
func (e *EWS) SimpleMsgHTML(clr, msg string) string {
|
||||||
|
now := time.Now().Format("2006-01-02 15:04:05")
|
||||||
resp := fmt.Sprintf(`<!DOCTYPE html>
|
resp := fmt.Sprintf(`<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<head>
|
<head>
|
||||||
<style>pre {word-wrap: break-word;}</style>
|
<style>pre {word-wrap: break-word;}</style>
|
||||||
<style>body {font-family: Calibri; font-size: 14px;}</style>
|
<style>body {font-family: Consolas; font-size: 14px;}</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<br/><span style="color: %s;">%s</span><br/>
|
<br/><span style="color: %s;">[%s] %s</span><br/>
|
||||||
</body>
|
</body>
|
||||||
</html>`, clr, msg)
|
</html>`, clr, now, msg)
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EWS) TemplateUutInfo(loc, locTime, misc, last, bkup string) string {
|
func (e *EWS) TemplateUutInfo(loc, locTime, misc, last, bkup string) string {
|
||||||
|
now := time.Now().Format("2006-01-02 15:04:05")
|
||||||
if loc == "" {
|
if loc == "" {
|
||||||
loc = `<span style="color: red; font-size: 14px; font-family: Consolas;">Unknown</span>`
|
loc = `<span style="color: red; font-size: 14px; font-family: Consolas;">Unknown</span>`
|
||||||
}
|
}
|
||||||
@ -667,11 +670,12 @@ func (e *EWS) TemplateUutInfo(loc, locTime, misc, last, bkup string) string {
|
|||||||
font-family: Consolas;
|
font-family: Consolas;
|
||||||
}
|
}
|
||||||
span {
|
span {
|
||||||
font-size: 14px;
|
font-size: 12px;
|
||||||
font-family: Consolas;
|
font-family: Consolas;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<body>
|
<body>
|
||||||
|
<span>Response Time: %s</span><br/><br/>
|
||||||
<span style="font-weight: bold; font-size: 16px;">Location Info</span>
|
<span style="font-weight: bold; font-size: 16px;">Location Info</span>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@ -716,13 +720,14 @@ func (e *EWS) TemplateUutInfo(loc, locTime, misc, last, bkup string) string {
|
|||||||
%s
|
%s
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html>`, loc, locTime, misc, last, bkup)
|
</html>`, now, loc, locTime, misc, last, bkup)
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EWS) TemplateDefectInfo(src string) string {
|
func (e *EWS) TemplateDefectInfo(src string) string {
|
||||||
|
now := time.Now().Format("2006-01-02 15:04:05")
|
||||||
if src == "" {
|
if src == "" {
|
||||||
src = `<span style="color: red;">NO Records !</span>`
|
src = fmt.Sprintf(`<span style="color: red;">[%s] NO Records !</span><br/>`, now)
|
||||||
}
|
}
|
||||||
resp := fmt.Sprintf(`<!DOCTYPE html>
|
resp := fmt.Sprintf(`<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@ -759,6 +764,7 @@ func (e *EWS) TemplateDefectInfo(src string) string {
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<body>
|
<body>
|
||||||
|
<span>Response Time: %s</span><br/>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>NO.</th>
|
<th>NO.</th>
|
||||||
@ -778,6 +784,6 @@ func (e *EWS) TemplateDefectInfo(src string) string {
|
|||||||
%s
|
%s
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html>`, src)
|
</html>`, now, src)
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user