前端页面
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package apps
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/httpdnsutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/policies"
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
)
|
||||
|
||||
@@ -11,15 +14,41 @@ type AppSettingsAction struct {
|
||||
}
|
||||
|
||||
func (this *AppSettingsAction) Init() {
|
||||
this.Nav("httpdns", "app", "")
|
||||
this.Nav("httpdns", "app", "settings")
|
||||
}
|
||||
|
||||
func (this *AppSettingsAction) RunGet(params struct {
|
||||
AppId int64
|
||||
AppId int64
|
||||
Section string
|
||||
}) {
|
||||
httpdnsutils.AddLeftMenu(this.Parent())
|
||||
app := pickApp(params.AppId)
|
||||
|
||||
// 顶部 tabbar
|
||||
httpdnsutils.AddAppTabbar(this.Parent(), app.GetString("name"), params.AppId, "settings")
|
||||
|
||||
// 当前选中的 section
|
||||
section := params.Section
|
||||
if len(section) == 0 {
|
||||
section = "basic"
|
||||
}
|
||||
this.Data["activeSection"] = section
|
||||
appIdStr := strconv.FormatInt(params.AppId, 10)
|
||||
this.Data["leftMenuItems"] = []map[string]interface{}{
|
||||
{
|
||||
"name": "基础配置",
|
||||
"url": "/httpdns/apps/app/settings?appId=" + appIdStr + "§ion=basic",
|
||||
"isActive": section == "basic",
|
||||
},
|
||||
{
|
||||
"name": "认证与密钥",
|
||||
"url": "/httpdns/apps/app/settings?appId=" + appIdStr + "§ion=auth",
|
||||
"isActive": section == "auth",
|
||||
},
|
||||
}
|
||||
|
||||
settings := loadAppSettings(app)
|
||||
this.Data["clusters"] = policies.LoadAvailableDeployClusters()
|
||||
this.Data["app"] = app
|
||||
this.Data["settings"] = settings
|
||||
this.Show()
|
||||
@@ -28,16 +57,24 @@ func (this *AppSettingsAction) RunGet(params struct {
|
||||
func (this *AppSettingsAction) RunPost(params struct {
|
||||
AppId int64
|
||||
|
||||
AppStatus bool
|
||||
AppStatus bool
|
||||
PrimaryClusterId int64
|
||||
BackupClusterId int64
|
||||
|
||||
Must *actions.Must
|
||||
CSRF *actionutils.CSRF
|
||||
}) {
|
||||
params.Must.Field("appId", params.AppId).Gt(0, "please select app")
|
||||
params.Must.Field("primaryClusterId", params.PrimaryClusterId).Gt(0, "please select primary cluster")
|
||||
if params.BackupClusterId > 0 && params.BackupClusterId == params.PrimaryClusterId {
|
||||
this.FailField("backupClusterId", "backup cluster must be different from primary cluster")
|
||||
}
|
||||
|
||||
app := pickApp(params.AppId)
|
||||
settings := loadAppSettings(app)
|
||||
settings["appStatus"] = params.AppStatus
|
||||
settings["primaryClusterId"] = params.PrimaryClusterId
|
||||
settings["backupClusterId"] = params.BackupClusterId
|
||||
|
||||
// SNI strategy is fixed to level2 empty.
|
||||
settings["sniPolicy"] = "level2"
|
||||
|
||||
Reference in New Issue
Block a user