50 lines
1.3 KiB
Go
50 lines
1.3 KiB
Go
package clusters
|
|
|
|
import (
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/httpdnsutils"
|
|
)
|
|
|
|
type ClusterSettingsAction struct {
|
|
actionutils.ParentAction
|
|
}
|
|
|
|
func (this *ClusterSettingsAction) Init() {
|
|
this.Nav("httpdns", "cluster", "settings")
|
|
}
|
|
|
|
func (this *ClusterSettingsAction) RunGet(params struct {
|
|
ClusterId int64
|
|
}) {
|
|
httpdnsutils.AddLeftMenu(this.Parent())
|
|
cluster := pickCluster(params.ClusterId)
|
|
installDir := cluster.GetString("installDir")
|
|
if len(installDir) == 0 {
|
|
installDir = "/opt/edge-httpdns"
|
|
}
|
|
this.Data["cluster"] = cluster
|
|
this.Data["settings"] = map[string]interface{}{
|
|
"region": cluster.GetString("region"),
|
|
"gatewayDomain": cluster.GetString("gatewayDomain"),
|
|
"cacheTtl": cluster.GetInt("cacheTtl"),
|
|
"fallbackTimeout": cluster.GetInt("fallbackTimeout"),
|
|
"installDir": installDir,
|
|
"isOn": cluster.GetBool("isOn"),
|
|
}
|
|
this.Show()
|
|
}
|
|
|
|
func (this *ClusterSettingsAction) RunPost(params struct {
|
|
ClusterId int64
|
|
Name string
|
|
Region string
|
|
GatewayDomain string
|
|
CacheTtl int32
|
|
FallbackTimeout int32
|
|
InstallDir string
|
|
IsOn bool
|
|
}) {
|
|
// Mock successful save
|
|
this.Success()
|
|
}
|