ups reconfiguration
This commit is contained in:
parent
ee7d2697ee
commit
e2d92daf31
@ -25,7 +25,7 @@ func init() {
|
||||
config.SetDefault(k, v)
|
||||
}
|
||||
Connected = false
|
||||
events.AddListener("config_changed", Reconfigure)
|
||||
events.AddListener("ups_config_changed", Reconfigure)
|
||||
}
|
||||
|
||||
func UpsConnect() {
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"git.openpdu.org/OpenPDU/openpdu/config"
|
||||
"git.openpdu.org/OpenPDU/openpdu/events"
|
||||
"git.openpdu.org/OpenPDU/openpdu/ups"
|
||||
"gopkg.in/macaron.v1"
|
||||
)
|
||||
@ -35,8 +36,8 @@ type UPSPostForm struct {
|
||||
Host string `form:"host" binding:"Required"`
|
||||
Port int `form:"port" binding:"Required"`
|
||||
UpsName string `form:"upsname" binding:"Required"`
|
||||
Username string `form:"username" binding:"Required"`
|
||||
Password string `form:"password" binding:"Required"`
|
||||
Username string `form:"username"`
|
||||
Password string `form:"password"`
|
||||
}
|
||||
|
||||
func upsPost(ctx *macaron.Context, f UPSPostForm) {
|
||||
@ -47,5 +48,7 @@ func upsPost(ctx *macaron.Context, f UPSPostForm) {
|
||||
config.Set("Ups.Password", f.Password)
|
||||
config.WriteConfig()
|
||||
|
||||
events.FireEvent("ups_config_changed")
|
||||
|
||||
upsPage(ctx)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user