mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 12:20:28 +08:00
节点安装界面显示SSH地址,方便用户校对
This commit is contained in:
@@ -2,9 +2,11 @@ package node
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/clusterutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
@@ -109,6 +111,26 @@ func (this *InstallAction) RunGet(params struct {
|
||||
var installerFiles = clusterutils.ListInstallerFiles()
|
||||
this.Data["installerFiles"] = installerFiles
|
||||
|
||||
// SSH主机地址
|
||||
this.Data["sshAddr"] = ""
|
||||
if node.NodeLogin != nil && node.NodeLogin.Type == "ssh" && !utils.JSONIsNull(node.NodeLogin.Params) {
|
||||
var loginParams = maps.Map{}
|
||||
err = json.Unmarshal(node.NodeLogin.Params, &loginParams)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
var host = loginParams.GetString("host")
|
||||
if len(host) > 0 {
|
||||
var port = loginParams.GetString("port")
|
||||
if port == "0" {
|
||||
port = "22"
|
||||
}
|
||||
this.Data["sshAddr"] = configutils.QuoteIP(host) + ":" + port
|
||||
}
|
||||
}
|
||||
|
||||
this.Show()
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
}
|
||||
|
||||
var grantMap = maps.Map{}
|
||||
grantId := loginParams.GetInt64("grantId")
|
||||
var grantId = loginParams.GetInt64("grantId")
|
||||
if grantId > 0 {
|
||||
grantResp, err := this.RPC().NodeGrantRPC().FindEnabledNodeGrant(this.AdminContext(), &pb.FindEnabledNodeGrantRequest{NodeGrantId: grantId})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user