mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	节点安装界面显示SSH地址,方便用户校对
This commit is contained in:
		@@ -2,9 +2,11 @@ package node
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"encoding/json"
 | 
						"encoding/json"
 | 
				
			||||||
 | 
						"github.com/TeaOSLab/EdgeAdmin/internal/utils"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
						"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/cluster/node/nodeutils"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/clusterutils"
 | 
						"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/langs/codes"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
 | 
						"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
						"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
				
			||||||
@@ -109,6 +111,26 @@ func (this *InstallAction) RunGet(params struct {
 | 
				
			|||||||
	var installerFiles = clusterutils.ListInstallerFiles()
 | 
						var installerFiles = clusterutils.ListInstallerFiles()
 | 
				
			||||||
	this.Data["installerFiles"] = installerFiles
 | 
						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()
 | 
						this.Show()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,7 +48,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		var grantMap = maps.Map{}
 | 
							var grantMap = maps.Map{}
 | 
				
			||||||
		grantId := loginParams.GetInt64("grantId")
 | 
							var grantId = loginParams.GetInt64("grantId")
 | 
				
			||||||
		if grantId > 0 {
 | 
							if grantId > 0 {
 | 
				
			||||||
			grantResp, err := this.RPC().NodeGrantRPC().FindEnabledNodeGrant(this.AdminContext(), &pb.FindEnabledNodeGrantRequest{NodeGrantId: grantId})
 | 
								grantResp, err := this.RPC().NodeGrantRPC().FindEnabledNodeGrant(this.AdminContext(), &pb.FindEnabledNodeGrantRequest{NodeGrantId: grantId})
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,15 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    <h4>方法1:通过SSH自动安装</h4>
 | 
					    <h4>方法1:通过SSH自动安装</h4>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <table class="ui table definition selectable">
 | 
				
			||||||
 | 
					        <tr>
 | 
				
			||||||
 | 
					            <td class="title">SSH地址</td>
 | 
				
			||||||
 | 
					            <td>
 | 
				
			||||||
 | 
					                <span v-if="sshAddr.length > 0">{{sshAddr}}   <a href="" @click.prevent="showSSHPopup(nodeId)">[修改]</a></span>
 | 
				
			||||||
 | 
					                <span v-else><span class="red">尚未设置</span>   <a href="" @click.prevent="showSSHPopup(nodeId)">[设置]</a></span>
 | 
				
			||||||
 | 
					            </td>
 | 
				
			||||||
 | 
					        </tr>
 | 
				
			||||||
 | 
					    </table>
 | 
				
			||||||
    <div v-if="installStatus != null && (installStatus.isRunning || installStatus.isFinished)"
 | 
					    <div v-if="installStatus != null && (installStatus.isRunning || installStatus.isFinished)"
 | 
				
			||||||
         class="ui segment installing-box">
 | 
					         class="ui segment installing-box">
 | 
				
			||||||
        <div v-if="installStatus.isRunning" class="blue">安装中...</div>
 | 
					        <div v-if="installStatus.isRunning" class="blue">安装中...</div>
 | 
				
			||||||
@@ -23,7 +32,7 @@
 | 
				
			|||||||
        <button class="ui button small" type="button" @click.prevent="install()">重新安装</button>
 | 
					        <button class="ui button small" type="button" @click.prevent="install()">重新安装</button>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <div v-if="installStatus == null || (!installStatus.isFinished && !installStatus.isRunning)">
 | 
					    <div v-if="installStatus == null || (!installStatus.isFinished && !installStatus.isRunning)">
 | 
				
			||||||
        <button class="ui button small" type="button" @click.prevent="install()">开始安装</button>
 | 
					        <button class="ui button small primary" type="button" @click.prevent="install()">开始安装</button>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <h4>方法2:手动安装</h4>
 | 
					    <h4>方法2:手动安装</h4>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -103,4 +103,15 @@ Tea.context(function () {
 | 
				
			|||||||
                }, 1000)
 | 
					                }, 1000)
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						this.showSSHPopup = function (nodeId) {
 | 
				
			||||||
 | 
							teaweb.popup("/clusters/cluster/updateNodeSSH?nodeId=" + nodeId, {
 | 
				
			||||||
 | 
								height: "30em",
 | 
				
			||||||
 | 
								callback: function () {
 | 
				
			||||||
 | 
									teaweb.success("保存成功", function () {
 | 
				
			||||||
 | 
										teaweb.reload()
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
		Reference in New Issue
	
	Block a user