mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 04:54:32 +08:00
37 lines
851 B
Go
37 lines
851 B
Go
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
|
|
|
package cluster
|
|
|
|
import (
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
|
)
|
|
|
|
type SuggestLoginPortsAction struct {
|
|
actionutils.ParentAction
|
|
}
|
|
|
|
func (this *SuggestLoginPortsAction) RunPost(params struct {
|
|
Host string
|
|
}) {
|
|
portsResp, err := this.RPC().NodeLoginRPC().FindNodeLoginSuggestPorts(this.AdminContext(), &pb.FindNodeLoginSuggestPortsRequest{Host: params.Host})
|
|
if err != nil {
|
|
this.ErrorPage(err)
|
|
return
|
|
}
|
|
|
|
if len(portsResp.Ports) == 0 {
|
|
this.Data["ports"] = []int32{}
|
|
} else {
|
|
this.Data["ports"] = portsResp.Ports
|
|
}
|
|
|
|
if len(portsResp.AvailablePorts) == 0 {
|
|
this.Data["availablePorts"] = []int32{}
|
|
} else {
|
|
this.Data["availablePorts"] = portsResp.AvailablePorts
|
|
}
|
|
|
|
this.Success()
|
|
}
|