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