2020-08-21 12:32:16 +08:00
|
|
|
package server
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
2021-06-07 15:43:43 +08:00
|
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
|
|
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
2020-08-21 12:32:16 +08:00
|
|
|
"strconv"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type IndexAction struct {
|
|
|
|
|
actionutils.ParentAction
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *IndexAction) Init() {
|
|
|
|
|
this.Nav("", "index", "index")
|
|
|
|
|
this.SecondMenu("index")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *IndexAction) RunGet(params struct {
|
|
|
|
|
ServerId int64
|
|
|
|
|
}) {
|
2020-09-21 11:37:24 +08:00
|
|
|
// TODO 等看板实现后,需要跳转到看板
|
2021-06-07 15:43:43 +08:00
|
|
|
|
|
|
|
|
// TCP & UDP跳转到设置
|
|
|
|
|
serverTypeResp, err := this.RPC().ServerRPC().FindEnabledServerType(this.AdminContext(), &pb.FindEnabledServerTypeRequest{ServerId: params.ServerId})
|
|
|
|
|
if err != nil {
|
|
|
|
|
this.ErrorPage(err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
serverType := serverTypeResp.Type
|
|
|
|
|
if serverType == serverconfigs.ServerTypeTCPProxy || serverType == serverconfigs.ServerTypeUDPProxy {
|
|
|
|
|
this.RedirectURL("/servers/server/settings?serverId=" + strconv.FormatInt(params.ServerId, 10))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// HTTP跳转到访问日志
|
2020-10-10 19:22:17 +08:00
|
|
|
this.RedirectURL("/servers/server/log?serverId=" + strconv.FormatInt(params.ServerId, 10))
|
2020-08-21 12:32:16 +08:00
|
|
|
}
|