mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 05:00:25 +08:00
路径规则改成路由规则
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package ns
|
||||
|
||||
import (
|
||||
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
@@ -19,6 +20,11 @@ func (this *IndexAction) RunGet(params struct {
|
||||
UserId int64
|
||||
Keyword string
|
||||
}) {
|
||||
if !teaconst.IsPlus {
|
||||
this.RedirectURL("/")
|
||||
return
|
||||
}
|
||||
|
||||
this.Data["clusterId"] = params.ClusterId
|
||||
this.Data["userId"] = params.UserId
|
||||
this.Data["keyword"] = params.Keyword
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 创建路径规则
|
||||
// CreateAction 创建路由规则
|
||||
type CreateAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 路径规则详情
|
||||
// IndexAction 路由规则详情
|
||||
type IndexAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
@@ -52,11 +52,11 @@ func (this *IndexAction) RunPost(params struct {
|
||||
|
||||
Must *actions.Must
|
||||
}) {
|
||||
defer this.CreateLogInfo("修改路径规则 %d 设置", params.LocationId)
|
||||
defer this.CreateLogInfo("修改路由规则 %d 设置", params.LocationId)
|
||||
|
||||
params.Must.
|
||||
Field("pattern", params.Pattern).
|
||||
Require("请输入路径匹配规则")
|
||||
Require("请输入路由匹配规则")
|
||||
|
||||
// 校验正则
|
||||
if params.PatternType == serverconfigs.HTTPLocationPatternTypeRegexp {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
)
|
||||
|
||||
// 查找路径规则配置
|
||||
// FindLocationConfig 查找路由规则配置
|
||||
func FindLocationConfig(parentAction *actionutils.ParentAction, locationId int64) (locationConfig *serverconfigs.HTTPLocationConfig, isOk bool) {
|
||||
locationConfigResp, err := parentAction.RPC().HTTPLocationRPC().FindEnabledHTTPLocationConfig(parentAction.AdminContext(), &pb.FindEnabledHTTPLocationConfigRequest{LocationId: locationId})
|
||||
if err != nil {
|
||||
|
||||
@@ -52,7 +52,7 @@ func (this *SettingAction) RunPost(params struct {
|
||||
|
||||
Must *actions.Must
|
||||
}) {
|
||||
defer this.CreateLogInfo("修改路径规则 %d 的反向代理设置", params.LocationId)
|
||||
defer this.CreateLogInfo("修改路由规则 %d 的反向代理设置", params.LocationId)
|
||||
|
||||
// TODO 校验配置
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ func (this *ServerHelper) createSettingsMenu(secondMenuItem string, serverIdStri
|
||||
"isOn": serverConfig.Web != nil && len(serverConfig.Web.HostRedirects) > 0,
|
||||
})
|
||||
menuItems = append(menuItems, maps.Map{
|
||||
"name": "路径规则",
|
||||
"name": "路由规则",
|
||||
"url": "/servers/server/settings/locations?serverId=" + serverIdString,
|
||||
"isActive": secondMenuItem == "locations",
|
||||
"isOn": serverConfig.Web != nil && len(serverConfig.Web.Locations) > 0,
|
||||
|
||||
Reference in New Issue
Block a user