From 07b9afd7d329222fee3eb3e6a6bf18429c979fc2 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 16 Mar 2022 15:24:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8A=82=E7=82=B9=E5=8F=AF=E4=BB=A5=E5=8D=95?= =?UTF-8?q?=E7=8B=AC=E8=AE=BE=E7=BD=AE=E7=BC=93=E5=AD=98=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/clusters/cluster/node/nodeutils/utils.go | 6 ++++++ .../default/clusters/cluster/node/settings/cache/index.go | 3 +++ .../clusters/cluster/node/settings/cache/index.html | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/internal/web/actions/default/clusters/cluster/node/nodeutils/utils.go b/internal/web/actions/default/clusters/cluster/node/nodeutils/utils.go index 05ba7097..3b2a295d 100644 --- a/internal/web/actions/default/clusters/cluster/node/nodeutils/utils.go +++ b/internal/web/actions/default/clusters/cluster/node/nodeutils/utils.go @@ -60,11 +60,15 @@ func InitNodeInfo(parentAction *actionutils.ParentAction, nodeId int64) (*pb.Nod "name": "DNS设置", "url": prefix + "/settings/dns?" + query, "isActive": menuItem == "dns", + "isOn": len(node.DnsRoutes) > 0, }, { "name": "缓存设置", "url": prefix + "/settings/cache?" + query, "isActive": menuItem == "cache", + "isOn": len(node.CacheDiskDir) > 0 || + (node.MaxCacheDiskCapacity != nil && node.MaxCacheDiskCapacity.Count > 0) || + (node.MaxCacheMemoryCapacity != nil && node.MaxCacheMemoryCapacity.Count > 0), }, } if teaconst.IsPlus { @@ -81,11 +85,13 @@ func InitNodeInfo(parentAction *actionutils.ParentAction, nodeId int64) (*pb.Nod "name": "SSH设置", "url": prefix + "/settings/ssh?" + query, "isActive": menuItem == "ssh", + "isOn": node.NodeLogin != nil, }, { "name": "系统设置", "url": prefix + "/settings/system?" + query, "isActive": menuItem == "system", + "isOn": node.MaxCPU > 0, }, }...) parentAction.Data["leftMenuItems"] = menuItems diff --git a/internal/web/actions/default/clusters/cluster/node/settings/cache/index.go b/internal/web/actions/default/clusters/cluster/node/settings/cache/index.go index c95d93f1..bc493651 100644 --- a/internal/web/actions/default/clusters/cluster/node/settings/cache/index.go +++ b/internal/web/actions/default/clusters/cluster/node/settings/cache/index.go @@ -59,6 +59,7 @@ func (this *IndexAction) RunGet(params struct { var nodeMap = this.Data["node"].(maps.Map) nodeMap["maxCacheDiskCapacity"] = maxCacheDiskCapacity + nodeMap["cacheDiskDir"] = node.CacheDiskDir nodeMap["maxCacheMemoryCapacity"] = maxCacheMemoryCapacity this.Show() @@ -67,6 +68,7 @@ func (this *IndexAction) RunGet(params struct { func (this *IndexAction) RunPost(params struct { NodeId int64 MaxCacheDiskCapacityJSON []byte + CacheDiskDir string MaxCacheMemoryCapacityJSON []byte Must *actions.Must @@ -106,6 +108,7 @@ func (this *IndexAction) RunPost(params struct { _, err := this.RPC().NodeRPC().UpdateNodeCache(this.AdminContext(), &pb.UpdateNodeCacheRequest{ NodeId: params.NodeId, MaxCacheDiskCapacity: pbMaxCacheDiskCapacity, + CacheDiskDir: params.CacheDiskDir, MaxCacheMemoryCapacity: pbMaxCacheMemoryCapacity, }) if err != nil { diff --git a/web/views/@default/clusters/cluster/node/settings/cache/index.html b/web/views/@default/clusters/cluster/node/settings/cache/index.html index cb211152..13000dce 100644 --- a/web/views/@default/clusters/cluster/node/settings/cache/index.html +++ b/web/views/@default/clusters/cluster/node/settings/cache/index.html @@ -14,6 +14,13 @@

缓存能使用的磁盘的最大容量,0表示不限制。

+ + 磁盘缓存目录 + + +

存放文件缓存的目录,通常填写绝对路径。不填则表示使用集群缓存策略中定义的目录。

+ + 缓存内存容量