diff --git a/internal/rpc/rpc_client.go b/internal/rpc/rpc_client.go index f3d961af..6bc3cd49 100644 --- a/internal/rpc/rpc_client.go +++ b/internal/rpc/rpc_client.go @@ -372,6 +372,10 @@ func (this *RPCClient) NSRouteRPC() pb.NSRouteServiceClient { return pb.NewNSRouteServiceClient(this.pickConn()) } +func (this *RPCClient) NSAccessLogRPC() pb.NSAccessLogServiceClient { + return pb.NewNSAccessLogServiceClient(this.pickConn()) +} + // Context 构造Admin上下文 func (this *RPCClient) Context(adminId int64) context.Context { ctx := context.Background() diff --git a/internal/web/actions/default/dashboard/index.go b/internal/web/actions/default/dashboard/index.go index bcc9e744..b664a7ee 100644 --- a/internal/web/actions/default/dashboard/index.go +++ b/internal/web/actions/default/dashboard/index.go @@ -93,25 +93,71 @@ func (this *IndexAction) RunGet(params struct{}) { } // 版本升级 - this.Data["nodeUpgradeInfo"] = maps.Map{ - "count": resp.NodeUpgradeInfo.CountNodes, - "version": resp.NodeUpgradeInfo.NewVersion, + if resp.NodeUpgradeInfo != nil { + this.Data["nodeUpgradeInfo"] = maps.Map{ + "count": resp.NodeUpgradeInfo.CountNodes, + "version": resp.NodeUpgradeInfo.NewVersion, + } + } else { + this.Data["nodeUpgradeInfo"] = maps.Map{ + "count": 0, + "version": "", + } } - this.Data["monitorNodeUpgradeInfo"] = maps.Map{ - "count": resp.MonitorNodeUpgradeInfo.CountNodes, - "version": resp.MonitorNodeUpgradeInfo.NewVersion, + if resp.MonitorNodeUpgradeInfo != nil { + this.Data["monitorNodeUpgradeInfo"] = maps.Map{ + "count": resp.MonitorNodeUpgradeInfo.CountNodes, + "version": resp.MonitorNodeUpgradeInfo.NewVersion, + } + } else { + this.Data["monitorNodeUpgradeInfo"] = maps.Map{ + "count": 0, + "version": "", + } } - this.Data["apiNodeUpgradeInfo"] = maps.Map{ - "count": resp.ApiNodeUpgradeInfo.CountNodes, - "version": resp.ApiNodeUpgradeInfo.NewVersion, + if resp.ApiNodeUpgradeInfo != nil { + this.Data["apiNodeUpgradeInfo"] = maps.Map{ + "count": resp.ApiNodeUpgradeInfo.CountNodes, + "version": resp.ApiNodeUpgradeInfo.NewVersion, + } + } else { + this.Data["apiNodeUpgradeInfo"] = maps.Map{ + "count": 0, + "version": "", + } } - this.Data["userNodeUpgradeInfo"] = maps.Map{ - "count": resp.UserNodeUpgradeInfo.CountNodes, - "version": resp.UserNodeUpgradeInfo.NewVersion, + if resp.UserNodeUpgradeInfo != nil { + this.Data["userNodeUpgradeInfo"] = maps.Map{ + "count": resp.UserNodeUpgradeInfo.CountNodes, + "version": resp.UserNodeUpgradeInfo.NewVersion, + } + } else { + this.Data["userNodeUpgradeInfo"] = maps.Map{ + "count": 0, + "version": 0, + } } - this.Data["authorityNodeUpgradeInfo"] = maps.Map{ - "count": resp.AuthorityNodeUpgradeInfo.CountNodes, - "version": resp.AuthorityNodeUpgradeInfo.NewVersion, + if resp.AuthorityNodeUpgradeInfo != nil { + this.Data["authorityNodeUpgradeInfo"] = maps.Map{ + "count": resp.AuthorityNodeUpgradeInfo.CountNodes, + "version": resp.AuthorityNodeUpgradeInfo.NewVersion, + } + } else { + this.Data["authorityNodeUpgradeInfo"] = maps.Map{ + "count": 0, + "version": "", + } + } + if resp.NsNodeUpgradeInfo != nil { + this.Data["nsNodeUpgradeInfo"] = maps.Map{ + "count": resp.NsNodeUpgradeInfo.CountNodes, + "version": resp.NsNodeUpgradeInfo.NewVersion, + } + } else { + this.Data["nsNodeUpgradeInfo"] = maps.Map{ + "count": 0, + "version": "", + } } this.Show() diff --git a/internal/web/actions/default/ns/clusters/accessLogs/index.go b/internal/web/actions/default/ns/clusters/accessLogs/index.go new file mode 100644 index 00000000..a7a7155e --- /dev/null +++ b/internal/web/actions/default/ns/clusters/accessLogs/index.go @@ -0,0 +1,166 @@ +// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. + +package logs + +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" + "github.com/iwind/TeaGo/lists" + "github.com/iwind/TeaGo/maps" + timeutil "github.com/iwind/TeaGo/utils/time" + "net" + "regexp" + "strings" +) + +type IndexAction struct { + actionutils.ParentAction +} + +func (this *IndexAction) Init() { + this.Nav("", "", "") +} + +func (this *IndexAction) RunGet(params struct { + RequestId string + Day string +}) { + day := strings.ReplaceAll(params.Day, "-", "") + if !regexp.MustCompile(`^\d{8}$`).MatchString(day) { + day = timeutil.Format("Ymd") + } + + this.Data["day"] = day[:4] + "-" + day[4:6] + "-" + day[6:] + this.Data["path"] = this.Request.URL.Path + + var size = int64(10) + + resp, err := this.RPC().NSAccessLogRPC().ListNSAccessLogs(this.AdminContext(), &pb.ListNSAccessLogsRequest{ + RequestId: params.RequestId, + NsNodeId: 0, + NsDomainId: 0, + NsRecordId: 0, + Size: size, + Day: day, + Reverse: false, + }) + if err != nil { + this.ErrorPage(err) + return + } + + ipList := []string{} + nodeIds := []int64{} + domainIds := []int64{} + if len(resp.NsAccessLogs) == 0 { + this.Data["accessLogs"] = []interface{}{} + } else { + this.Data["accessLogs"] = resp.NsAccessLogs + for _, accessLog := range resp.NsAccessLogs { + // IP + if len(accessLog.RemoteAddr) > 0 { + // 去掉端口 + ip, _, err := net.SplitHostPort(accessLog.RemoteAddr) + if err == nil { + accessLog.RemoteAddr = ip + if !lists.ContainsString(ipList, ip) { + ipList = append(ipList, ip) + } + } + } + + // 节点 + if !lists.ContainsInt64(nodeIds, accessLog.NsNodeId) { + nodeIds = append(nodeIds, accessLog.NsNodeId) + } + + // 域名 + if !lists.ContainsInt64(domainIds, accessLog.NsDomainId) { + domainIds = append(domainIds, accessLog.NsDomainId) + } + } + } + this.Data["hasMore"] = resp.HasMore + this.Data["nextRequestId"] = resp.RequestId + + // 上一个requestId + this.Data["hasPrev"] = false + this.Data["lastRequestId"] = "" + if len(params.RequestId) > 0 { + this.Data["hasPrev"] = true + prevResp, err := this.RPC().NSAccessLogRPC().ListNSAccessLogs(this.AdminContext(), &pb.ListNSAccessLogsRequest{ + RequestId: params.RequestId, + NsNodeId: 0, + NsDomainId: 0, + NsRecordId: 0, + Day: day, + Size: size, + Reverse: true, + }) + if err != nil { + this.ErrorPage(err) + return + } + if int64(len(prevResp.NsAccessLogs)) == size { + this.Data["lastRequestId"] = prevResp.RequestId + } + } + + // 根据IP查询区域 + regionMap := map[string]string{} // ip => region + if len(ipList) > 0 { + resp, err := this.RPC().IPLibraryRPC().LookupIPRegions(this.AdminContext(), &pb.LookupIPRegionsRequest{IpList: ipList}) + if err != nil { + this.ErrorPage(err) + return + } + if resp.IpRegionMap != nil { + for ip, region := range resp.IpRegionMap { + regionMap[ip] = region.Summary + } + } + } + this.Data["regions"] = regionMap + + // 节点信息 + nodeMap := map[int64]interface{}{} // node id => { ... } + for _, nodeId := range nodeIds { + nodeResp, err := this.RPC().NSNodeRPC().FindEnabledNSNode(this.AdminContext(), &pb.FindEnabledNSNodeRequest{NsNodeId: nodeId}) + if err != nil { + this.ErrorPage(err) + return + } + node := nodeResp.NsNode + if node != nil { + nodeMap[node.Id] = maps.Map{ + "id": node.Id, + "name": node.Name, + "cluster": maps.Map{ + "id": node.NsCluster.Id, + "name": node.NsCluster.Name, + }, + } + } + } + this.Data["nodes"] = nodeMap + + // 域名信息 + domainMap := map[int64]interface{}{} // domain id => { ... } + for _, domainId := range domainIds { + domainResp, err := this.RPC().NSDomainRPC().FindEnabledNSDomain(this.AdminContext(), &pb.FindEnabledNSDomainRequest{NsDomainId: domainId}) + if err != nil { + this.ErrorPage(err) + return + } + domain := domainResp.NsDomain + if domain != nil { + domainMap[domain.Id] = maps.Map{ + "id": domain.Id, + "name": domain.Name, + } + } + } + this.Data["domains"] = domainMap + + this.Show() +} diff --git a/internal/web/actions/default/ns/clusters/accessLogs/init.go b/internal/web/actions/default/ns/clusters/accessLogs/init.go new file mode 100644 index 00000000..023cc9a6 --- /dev/null +++ b/internal/web/actions/default/ns/clusters/accessLogs/init.go @@ -0,0 +1,19 @@ +package logs + +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" + "github.com/TeaOSLab/EdgeAdmin/internal/web/helpers" + "github.com/iwind/TeaGo" +) + +func init() { + TeaGo.BeforeStart(func(server *TeaGo.Server) { + server. + Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeNS)). + Data("teaMenu", "ns"). + Data("teaSubMenu", "accessLog"). + Prefix("/ns/clusters/accessLogs"). + Get("", new(IndexAction)). + EndAll() + }) +} diff --git a/internal/web/actions/default/ns/clusters/cluster/settings/accessLog/index.go b/internal/web/actions/default/ns/clusters/cluster/settings/accessLog/index.go new file mode 100644 index 00000000..9e3e0de5 --- /dev/null +++ b/internal/web/actions/default/ns/clusters/cluster/settings/accessLog/index.go @@ -0,0 +1,73 @@ +// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. + +package cluster + +import ( + "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/dnsconfigs" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" + "github.com/iwind/TeaGo/actions" +) + +type IndexAction struct { + actionutils.ParentAction +} + +func (this *IndexAction) Init() { + this.Nav("", "setting", "") + this.SecondMenu("accessLog") +} + +func (this *IndexAction) RunGet(params struct { + ClusterId int64 +}) { + accessLogResp, err := this.RPC().NSClusterRPC().FindNSClusterAccessLog(this.AdminContext(), &pb.FindNSClusterAccessLogRequest{NsClusterId: params.ClusterId}) + if err != nil { + this.ErrorPage(err) + return + } + + accessLogRef := &dnsconfigs.AccessLogRef{} + if len(accessLogResp.AccessLogJSON) > 0 { + err = json.Unmarshal(accessLogResp.AccessLogJSON, accessLogRef) + if err != nil { + this.ErrorPage(err) + return + } + } + this.Data["accessLogRef"] = accessLogRef + + this.Show() +} + +func (this *IndexAction) RunPost(params struct { + ClusterId int64 + AccessLogJSON []byte + + Must *actions.Must + CSRF *actionutils.CSRF +}) { + defer this.CreateLogInfo("修改域名服务集群 %d 访问日志配置", params.ClusterId) + + ref := &dnsconfigs.AccessLogRef{} + err := json.Unmarshal(params.AccessLogJSON, ref) + if err != nil { + this.Fail("数据格式错误:" + err.Error()) + } + err = ref.Init() + if err != nil { + this.Fail("数据格式错误:" + err.Error()) + } + + _, err = this.RPC().NSClusterRPC().UpdateNSClusterAccessLog(this.AdminContext(), &pb.UpdateNSClusterAccessLogRequest{ + NsClusterId: params.ClusterId, + AccessLogJSON: params.AccessLogJSON, + }) + if err != nil { + this.ErrorPage(err) + return + } + + this.Success() +} diff --git a/internal/web/actions/default/ns/clusters/cluster/settings/accessLog/init.go b/internal/web/actions/default/ns/clusters/cluster/settings/accessLog/init.go new file mode 100644 index 00000000..40468e95 --- /dev/null +++ b/internal/web/actions/default/ns/clusters/cluster/settings/accessLog/init.go @@ -0,0 +1,21 @@ +package cluster + +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ns/clusters/clusterutils" + "github.com/TeaOSLab/EdgeAdmin/internal/web/helpers" + "github.com/iwind/TeaGo" +) + +func init() { + TeaGo.BeforeStart(func(server *TeaGo.Server) { + server. + Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeNS)). + Helper(new(clusterutils.ClusterHelper)). + Data("teaMenu", "ns"). + Data("teaSubMenu", "cluster"). + Prefix("/ns/clusters/cluster/settings/accessLog"). + GetPost("", new(IndexAction)). + EndAll() + }) +} diff --git a/internal/web/actions/default/ns/clusters/clusterutils/cluster_helper.go b/internal/web/actions/default/ns/clusters/clusterutils/cluster_helper.go index f4a0e45f..209b03f1 100644 --- a/internal/web/actions/default/ns/clusters/clusterutils/cluster_helper.go +++ b/internal/web/actions/default/ns/clusters/clusterutils/cluster_helper.go @@ -83,5 +83,10 @@ func (this *ClusterHelper) createSettingMenu(cluster *pb.NSCluster, selectedItem "url": "/ns/clusters/cluster/settings?clusterId=" + clusterId, "isActive": selectedItem == "basic", }) + items = append(items, maps.Map{ + "name": "访问日志", + "url": "/ns/clusters/cluster/settings/accessLog?clusterId=" + clusterId, + "isActive": selectedItem == "accessLog", + }) return } diff --git a/internal/web/actions/default/servers/components/waf/log.go b/internal/web/actions/default/servers/components/waf/log.go index 609109b6..81063ae9 100644 --- a/internal/web/actions/default/servers/components/waf/log.go +++ b/internal/web/actions/default/servers/components/waf/log.go @@ -53,11 +53,11 @@ func (this *LogAction) RunGet(params struct { return } - if len(resp.AccessLogs) == 0 { + if len(resp.HttpAccessLogs) == 0 { this.Data["accessLogs"] = []interface{}{} } else { - this.Data["accessLogs"] = resp.AccessLogs - for _, accessLog := range resp.AccessLogs { + this.Data["accessLogs"] = resp.HttpAccessLogs + for _, accessLog := range resp.HttpAccessLogs { if len(accessLog.RemoteAddr) > 0 { if !lists.ContainsString(ipList, accessLog.RemoteAddr) { ipList = append(ipList, accessLog.RemoteAddr) @@ -85,7 +85,7 @@ func (this *LogAction) RunGet(params struct { this.ErrorPage(err) return } - if int64(len(prevResp.AccessLogs)) == size { + if int64(len(prevResp.HttpAccessLogs)) == size { this.Data["lastRequestId"] = prevResp.RequestId } } diff --git a/internal/web/actions/default/servers/server/log/history.go b/internal/web/actions/default/servers/server/log/history.go index da4480bc..0d38b541 100644 --- a/internal/web/actions/default/servers/server/log/history.go +++ b/internal/web/actions/default/servers/server/log/history.go @@ -55,11 +55,11 @@ func (this *HistoryAction) RunGet(params struct { return } - if len(resp.AccessLogs) == 0 { + if len(resp.HttpAccessLogs) == 0 { this.Data["accessLogs"] = []interface{}{} } else { - this.Data["accessLogs"] = resp.AccessLogs - for _, accessLog := range resp.AccessLogs { + this.Data["accessLogs"] = resp.HttpAccessLogs + for _, accessLog := range resp.HttpAccessLogs { if len(accessLog.RemoteAddr) > 0 { if !lists.ContainsString(ipList, accessLog.RemoteAddr) { ipList = append(ipList, accessLog.RemoteAddr) @@ -87,7 +87,7 @@ func (this *HistoryAction) RunGet(params struct { this.ErrorPage(err) return } - if int64(len(prevResp.AccessLogs)) == size { + if int64(len(prevResp.HttpAccessLogs)) == size { this.Data["lastRequestId"] = prevResp.RequestId } } diff --git a/internal/web/actions/default/servers/server/log/index.go b/internal/web/actions/default/servers/server/log/index.go index 696de90c..e15a6405 100644 --- a/internal/web/actions/default/servers/server/log/index.go +++ b/internal/web/actions/default/servers/server/log/index.go @@ -57,7 +57,7 @@ func (this *IndexAction) RunPost(params struct { } ipList := []string{} - accessLogs := accessLogsResp.AccessLogs + accessLogs := accessLogsResp.HttpAccessLogs if len(accessLogs) == 0 { accessLogs = []*pb.HTTPAccessLog{} } else { diff --git a/internal/web/actions/default/servers/server/log/today.go b/internal/web/actions/default/servers/server/log/today.go index 8baabce3..0343ad1d 100644 --- a/internal/web/actions/default/servers/server/log/today.go +++ b/internal/web/actions/default/servers/server/log/today.go @@ -39,11 +39,11 @@ func (this *TodayAction) RunGet(params struct { } ipList := []string{} - if len(resp.AccessLogs) == 0 { + if len(resp.HttpAccessLogs) == 0 { this.Data["accessLogs"] = []interface{}{} } else { - this.Data["accessLogs"] = resp.AccessLogs - for _, accessLog := range resp.AccessLogs { + this.Data["accessLogs"] = resp.HttpAccessLogs + for _, accessLog := range resp.HttpAccessLogs { if len(accessLog.RemoteAddr) > 0 { if !lists.ContainsString(ipList, accessLog.RemoteAddr) { ipList = append(ipList, accessLog.RemoteAddr) @@ -71,7 +71,7 @@ func (this *TodayAction) RunGet(params struct { this.ErrorPage(err) return } - if int64(len(prevResp.AccessLogs)) == size { + if int64(len(prevResp.HttpAccessLogs)) == size { this.Data["lastRequestId"] = prevResp.RequestId } } diff --git a/internal/web/actions/default/servers/server/log/viewPopup.go b/internal/web/actions/default/servers/server/log/viewPopup.go index 8560fae6..b23b7c9a 100644 --- a/internal/web/actions/default/servers/server/log/viewPopup.go +++ b/internal/web/actions/default/servers/server/log/viewPopup.go @@ -23,7 +23,7 @@ func (this *ViewPopupAction) RunGet(params struct { this.ErrorPage(err) return } - accessLog := accessLogResp.AccessLog + accessLog := accessLogResp.HttpAccessLog if accessLog == nil { this.WriteString("not found: " + params.RequestId) return diff --git a/internal/web/helpers/user_must_auth.go b/internal/web/helpers/user_must_auth.go index b8e2ba03..49d27bf5 100644 --- a/internal/web/helpers/user_must_auth.go +++ b/internal/web/helpers/user_must_auth.go @@ -182,7 +182,7 @@ func (this *userMustAuth) modules(adminId int64) []maps.Map { "icon": "cloud", "subItems": []maps.Map{ { - "name": "节点日志", + "name": "运行日志", "url": "/clusters/logs", "code": "log", }, @@ -236,7 +236,12 @@ func (this *userMustAuth) modules(adminId int64) []maps.Map { "code": "route", }, { - "name": "节点日志", + "name": "访问日志", + "url": "/ns/clusters/accessLogs", + "code": "accessLog", + }, + { + "name": "运行日志", "url": "/ns/clusters/logs", "code": "log", }, diff --git a/internal/web/import.go b/internal/web/import.go index 2ceec7ea..72419d93 100644 --- a/internal/web/import.go +++ b/internal/web/import.go @@ -3,14 +3,20 @@ package web import ( _ "github.com/TeaOSLab/EdgeAdmin/internal/tasks" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/about" + + // 系统用户 _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/admins" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/admins/recipients" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/admins/recipients/groups" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/admins/recipients/instances" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/admins/recipients/logs" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/admins/recipients/tasks" + + // API节点 _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/api" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/api/node" + + // 节点集群 _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings" @@ -19,6 +25,8 @@ import ( _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/regions" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/regions/items" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/tasks" + + // 通用 _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/csrf" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dashboard" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/db" @@ -31,12 +39,15 @@ import ( _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/logout" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/messages" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes" + _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ui" // 域名服务 _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ns" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ns/clusters" + _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ns/clusters/accessLogs" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ns/clusters/cluster" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ns/clusters/cluster/settings" + _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ns/clusters/cluster/settings/accessLog" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ns/clusters/logs" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ns/routes" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ns/users" @@ -116,7 +127,10 @@ import ( _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/upgrade" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/user-nodes" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/user-ui" + + // 安装 _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/setup" - _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ui" + + // 平台用户 _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/users" ) diff --git a/web/public/js/components/ns/ns-access-log-box.js b/web/public/js/components/ns/ns-access-log-box.js new file mode 100644 index 00000000..d30bea8f --- /dev/null +++ b/web/public/js/components/ns/ns-access-log-box.js @@ -0,0 +1,38 @@ +Vue.component("ns-access-log-box", { + props: ["v-access-log"], + data: function () { + let accessLog = this.vAccessLog + return { + accessLog: accessLog + } + }, + methods: { + showLog: function () { + let that = this + let requestId = this.accessLog.requestId + this.$parent.$children.forEach(function (v) { + if (v.deselect != null) { + v.deselect() + } + }) + this.select() + + teaweb.popup("/ns/clusters/accessLogs/viewPopup?requestId=" + requestId, { + width: "50em", + height: "24em", + onClose: function () { + that.deselect() + } + }) + }, + select: function () { + this.$refs.box.parentNode.style.cssText = "background: rgba(0, 0, 0, 0.1)" + }, + deselect: function () { + this.$refs.box.parentNode.style.cssText = "" + } + }, + template: `
| 是否启用 | +
+ |
+
暂时还没有访问日志。
+ +| 集群 | +节点 | +域名 | +概要 | +
|---|---|---|---|
|
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+