From 1d521602e109873190637de4b2ea0e2c4b650eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Wed, 26 Oct 2022 19:23:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8A=82=E7=82=B9SSH=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E4=BD=BF=E7=94=A8=E9=9B=86=E7=BE=A4=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clusters/cluster/settings/index.go | 25 ++++++++++++++++++- .../clusters/cluster/node/detail.html | 2 +- .../clusters/cluster/settings/index.html | 11 ++++++-- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/internal/web/actions/default/clusters/cluster/settings/index.go b/internal/web/actions/default/clusters/cluster/settings/index.go index ddc8f585..2c07ceaf 100644 --- a/internal/web/actions/default/clusters/cluster/settings/index.go +++ b/internal/web/actions/default/clusters/cluster/settings/index.go @@ -45,7 +45,7 @@ func (this *IndexAction) RunGet(params struct { this.ErrorPage(err) return } - grant := grantResp.NodeGrant + var grant = grantResp.NodeGrant if grant != nil { grantMap = maps.Map{ "id": grant.Id, @@ -79,6 +79,16 @@ func (this *IndexAction) RunGet(params struct { } } + // SSH参数 + var sshParams = nodeconfigs.DefaultSSHParams() + if len(cluster.SshParamsJSON) > 0 { + err = json.Unmarshal(cluster.SshParamsJSON, sshParams) + if err != nil { + this.ErrorPage(err) + return + } + } + this.Data["cluster"] = maps.Map{ "id": cluster.Id, "name": cluster.Name, @@ -89,6 +99,7 @@ func (this *IndexAction) RunGet(params struct { "clock": clockConfig, "autoRemoteStart": cluster.AutoRemoteStart, "autoInstallNftables": cluster.AutoInstallNftables, + "sshParams": sshParams, } // 默认值 @@ -104,6 +115,7 @@ func (this *IndexAction) RunPost(params struct { ClusterId int64 Name string GrantId int64 + SshParamsPort int InstallDir string TimeZone string NodeMaxThreads int32 @@ -129,6 +141,16 @@ func (this *IndexAction) RunPost(params struct { Lte(int64(nodeconfigs.DefaultMaxThreadsMax), "单节点最大线程数最大值不能大于"+types.String(nodeconfigs.DefaultMaxThreadsMax)) } + // ssh + var sshParams = nodeconfigs.DefaultSSHParams() + sshParams.Port = params.SshParamsPort + sshParamsJSON, err := json.Marshal(sshParams) + if err != nil { + this.ErrorPage(err) + return + } + + // clock var clockConfig = nodeconfigs.DefaultClockConfig() clockConfig.AutoSync = params.ClockAutoSync clockConfig.Server = params.ClockServer @@ -155,6 +177,7 @@ func (this *IndexAction) RunPost(params struct { ClockJSON: clockConfigJSON, AutoRemoteStart: params.AutoRemoteStart, AutoInstallNftables: params.AutoInstallNftables, + SshParamsJSON: sshParamsJSON, }) if err != nil { this.ErrorPage(err) diff --git a/web/views/@default/clusters/cluster/node/detail.html b/web/views/@default/clusters/cluster/node/detail.html index de47be57..aa1e7b73 100644 --- a/web/views/@default/clusters/cluster/node/detail.html +++ b/web/views/@default/clusters/cluster/node/detail.html @@ -175,7 +175,7 @@

运行状态

- + - + + + + +
是否在运行运行状态
运行中   diff --git a/web/views/@default/clusters/cluster/settings/index.html b/web/views/@default/clusters/cluster/settings/index.html index 85bb90ea..209a7cca 100644 --- a/web/views/@default/clusters/cluster/settings/index.html +++ b/web/views/@default/clusters/cluster/settings/index.html @@ -11,12 +11,19 @@
默认SSH登录方式默认SSH认证 -

当节点没有单独设置SSH登录方式时,默认使用此设置。

+

当节点没有单独设置SSH认证时,默认使用此设置。

默认SSH端口 + +

节点默认SSH登录端口。

+
节点安装目录