2020-11-22 15:34:13 +08:00
|
|
|
package server
|
2020-10-15 16:41:32 +08:00
|
|
|
|
|
|
|
|
import (
|
2020-11-22 15:34:13 +08:00
|
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/uimanager"
|
2020-10-15 16:41:32 +08:00
|
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
2020-11-22 15:34:13 +08:00
|
|
|
"github.com/iwind/TeaGo/actions"
|
2020-10-15 16:41:32 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type IndexAction struct {
|
|
|
|
|
actionutils.ParentAction
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *IndexAction) Init() {
|
|
|
|
|
this.Nav("", "", "")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *IndexAction) RunGet(params struct{}) {
|
2020-11-22 15:34:13 +08:00
|
|
|
config, err := uimanager.LoadUIConfig()
|
2020-10-15 16:41:32 +08:00
|
|
|
if err != nil {
|
|
|
|
|
this.ErrorPage(err)
|
|
|
|
|
return
|
|
|
|
|
}
|
2020-11-22 15:34:13 +08:00
|
|
|
this.Data["config"] = config
|
2020-10-15 16:41:32 +08:00
|
|
|
|
|
|
|
|
this.Show()
|
|
|
|
|
}
|
2020-11-22 15:34:13 +08:00
|
|
|
|
|
|
|
|
func (this *IndexAction) RunPost(params struct {
|
|
|
|
|
ProductName string
|
|
|
|
|
AdminSystemName string
|
|
|
|
|
ShowOpenSourceInfo bool
|
|
|
|
|
ShowVersion bool
|
|
|
|
|
Version string
|
|
|
|
|
|
|
|
|
|
Must *actions.Must
|
|
|
|
|
CSRF *actionutils.CSRF
|
|
|
|
|
}) {
|
|
|
|
|
params.Must.
|
|
|
|
|
Field("productName", params.ProductName).
|
|
|
|
|
Require("请输入产品名称").
|
|
|
|
|
Field("adminSystemName", params.AdminSystemName).
|
|
|
|
|
Require("请输入管理员系统名称")
|
|
|
|
|
|
|
|
|
|
config, err := uimanager.LoadUIConfig()
|
|
|
|
|
if err != nil {
|
|
|
|
|
this.ErrorPage(err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
config.ProductName = params.ProductName
|
|
|
|
|
config.AdminSystemName = params.AdminSystemName
|
|
|
|
|
config.ShowOpenSourceInfo = params.ShowOpenSourceInfo
|
|
|
|
|
config.ShowVersion = params.ShowVersion
|
|
|
|
|
config.Version = params.Version
|
|
|
|
|
err = uimanager.UpdateUIConfig(config)
|
|
|
|
|
if err != nil {
|
|
|
|
|
this.ErrorPage(err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.Success()
|
|
|
|
|
}
|