mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-10 00:00:26 +08:00
节点IP增加是否启用、是否在线状态
This commit is contained in:
@@ -2,6 +2,7 @@ package ipAddresses
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"net"
|
||||
@@ -26,15 +27,25 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
IP string `alias:"ip"`
|
||||
Name string
|
||||
CanAccess bool
|
||||
IsOn bool
|
||||
|
||||
Must *actions.Must
|
||||
}) {
|
||||
// TODO 严格校验IP地址
|
||||
|
||||
params.Must.
|
||||
Field("ip", params.IP).
|
||||
Require("请输入IP地址")
|
||||
|
||||
// 获取IP地址信息
|
||||
addressResp, err := this.RPC().NodeIPAddressRPC().FindEnabledNodeIPAddress(this.AdminContext(), &pb.FindEnabledNodeIPAddressRequest{AddressId: params.AddressId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
var address = addressResp.IpAddress
|
||||
if address == nil {
|
||||
this.Fail("找不到要修改的地址")
|
||||
}
|
||||
|
||||
ip := net.ParseIP(params.IP)
|
||||
if len(ip) == 0 {
|
||||
this.Fail("请输入正确的IP")
|
||||
@@ -45,6 +56,8 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
"ip": params.IP,
|
||||
"id": params.AddressId,
|
||||
"canAccess": params.CanAccess,
|
||||
"isOn": params.IsOn,
|
||||
"isUp": address.IsUp,
|
||||
}
|
||||
|
||||
this.Success()
|
||||
|
||||
Reference in New Issue
Block a user