mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
节点选择认证时增加推荐
This commit is contained in:
@@ -219,6 +219,7 @@ func (this *CreateNodeAction) RunPost(params struct {
|
||||
"name": grantResp.NodeGrant.Name,
|
||||
"method": grantResp.NodeGrant.Method,
|
||||
"methodName": grantutils.FindGrantMethodName(grantResp.NodeGrant.Method),
|
||||
"username": grantResp.NodeGrant.Username,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,6 +165,7 @@ func (this *DetailAction) RunGet(params struct {
|
||||
"name": grantResp.NodeGrant.Name,
|
||||
"method": grantResp.NodeGrant.Method,
|
||||
"methodName": grantutils.FindGrantMethodName(grantResp.NodeGrant.Method),
|
||||
"username": grantResp.NodeGrant.Username,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +150,7 @@ func (this *UpdateAction) RunGet(params struct {
|
||||
"name": grantResp.NodeGrant.Name,
|
||||
"method": grantResp.NodeGrant.Method,
|
||||
"methodName": grantutils.FindGrantMethodName(grantResp.NodeGrant.Method),
|
||||
"username": grantResp.NodeGrant.Username,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,11 @@ func (this *UpdateNodeSSHAction) RunGet(params struct {
|
||||
"id": node.Id,
|
||||
"name": node.Name,
|
||||
}
|
||||
if nodeResp.Node.NodeCluster != nil {
|
||||
this.Data["clusterId"] = nodeResp.Node.NodeCluster.Id
|
||||
} else {
|
||||
this.Data["clusterId"] = 0
|
||||
}
|
||||
|
||||
// SSH
|
||||
loginParams := maps.Map{
|
||||
|
||||
@@ -16,7 +16,10 @@ func (this *SelectPopupAction) Init() {
|
||||
this.Nav("", "", "")
|
||||
}
|
||||
|
||||
func (this *SelectPopupAction) RunGet(params struct{}) {
|
||||
func (this *SelectPopupAction) RunGet(params struct {
|
||||
NodeClusterId int64
|
||||
NsClusterId int64
|
||||
}) {
|
||||
// 所有的认证
|
||||
grantsResp, err := this.RPC().NodeGrantRPC().FindAllEnabledNodeGrants(this.AdminContext(), &pb.FindAllEnabledNodeGrantsRequest{})
|
||||
if err != nil {
|
||||
@@ -37,6 +40,28 @@ func (this *SelectPopupAction) RunGet(params struct{}) {
|
||||
}
|
||||
this.Data["grants"] = grantMaps
|
||||
|
||||
// 推荐的认证
|
||||
suggestGrantsResp, err := this.RPC().NodeGrantRPC().FindSuggestNodeGrants(this.AdminContext(), &pb.FindSuggestNodeGrantsRequest{
|
||||
NodeClusterId: params.NodeClusterId,
|
||||
NsClusterId: params.NsClusterId,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
var suggestGrantMaps = []maps.Map{}
|
||||
for _, grant := range suggestGrantsResp.NodeGrants {
|
||||
suggestGrantMaps = append(suggestGrantMaps, maps.Map{
|
||||
"id": grant.Id,
|
||||
"name": grant.Name,
|
||||
"method": grant.Method,
|
||||
"methodName": grantutils.FindGrantMethodName(grant.Method),
|
||||
"username": grant.Username,
|
||||
"description": grant.Description,
|
||||
})
|
||||
}
|
||||
this.Data["suggestGrants"] = suggestGrantMaps
|
||||
|
||||
this.Show()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user